Browse Source

Add failing test

bubble
Kyle Shockey 7 years ago
parent
commit
8919661438
2 changed files with 24 additions and 1 deletions
  1. +1
    -1
      package.json
  2. +23
    -0
      test/bugs/3199-sanitization-escaping.js

+ 1
- 1
package.json View File

@@ -32,7 +32,7 @@
"test": "npm run lint-errors && npm run just-test-in-node",
"test-in-node": "npm run lint-errors && npm run just-test-in-node",
"just-test": "karma start --config karma.conf.js",
"just-test-in-node": "mocha --recursive --compilers js:babel-core/register test/core test/components"
"just-test-in-node": "mocha --recursive --compilers js:babel-core/register test/core test/components test/bugs"
},
"dependencies": {
"babel-polyfill": "^6.23.0",


+ 23
- 0
test/bugs/3199-sanitization-escaping.js View File

@@ -0,0 +1,23 @@
/* eslint-env mocha */
import React from "react"
import expect from "expect"
import { render } from "enzyme"
import Markdown from "components/providers/markdown"

describe("UI-3199: Sanitized Markdown causing code examples to be double escaped", function(){
it("should single-escape quotes", function(){

let str = "" +
"This is a test: \n\n" +
" {\"abc\": \"def\"}\n"

let props = {
source: str
}

let el = render(<Markdown {...props}/>)

expect(el.find("code").first().text()).toEqual("{\"abc\": \"def\"}\n")
expect(el.find("code").first().html()).toEqual("{&quot;abc&quot;: &quot;def&quot;}\n")
})
})

Loading…
Cancel
Save