3199-sanitization-escaping.jsx 598 B

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