You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3199-sanitization-escaping.js 649 B

7 vuotta sitten
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. })