您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

3199-sanitization-escaping.jsx 649 B

1234567891011121314151617181920212223
  1. /* eslint-env mocha */
  2. import React from "react"
  3. import expect from "expect"
  4. import { render } from "enzyme"
  5. import Markdown from "components/providers/markdown"
  6. describe("UI-3199: Sanitized Markdown causing code examples to be double escaped", function(){
  7. it("should single-escape quotes", function(){
  8. let str = "" +
  9. "This is a test: \n\n" +
  10. " {\"abc\": \"def\"}\n"
  11. let props = {
  12. source: str
  13. }
  14. let el = render(<Markdown {...props}/>)
  15. expect(el.find("code").first().text()).toEqual("{\"abc\": \"def\"}\n")
  16. expect(el.find("code").first().html()).toEqual("{&quot;abc&quot;: &quot;def&quot;}\n")
  17. })
  18. })