Adds test
This commit is contained in:
parent
2cc898877d
commit
aad2fc3e33
2 changed files with 12 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ describe("m.trust()", function () {
|
||||||
// FIXME: implement document.createRange().createContextualFragment() in the
|
// FIXME: implement document.createRange().createContextualFragment() in the
|
||||||
// mock window for these tests
|
// mock window for these tests
|
||||||
dom(function () {
|
dom(function () {
|
||||||
|
|
||||||
it("isn't escaped in m.render()", function () {
|
it("isn't escaped in m.render()", function () {
|
||||||
var root = document.createElement("div")
|
var root = document.createElement("div")
|
||||||
m.render(root, m("div", "a", m.trust("&"), "b"))
|
m.render(root, m("div", "a", m.trust("&"), "b"))
|
||||||
|
|
@ -54,5 +55,16 @@ describe("m.trust()", function () {
|
||||||
|
|
||||||
expect(root.childNodes[2].tagName).to.equal("TD")
|
expect(root.childNodes[2].tagName).to.equal("TD")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("works with trusted content in div", function () {
|
||||||
|
var root = document.createElement("div")
|
||||||
|
m.render(root, m('div', [
|
||||||
|
m('p', '©'),
|
||||||
|
m('p', m.trust('©')),
|
||||||
|
m.trust('©'),
|
||||||
|
]))
|
||||||
|
expect(root.innerHTML).to.equal("<div><p>&copy;</p><p>©</p>©</div>")
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
0
tests/trust-test.html
Normal file
0
tests/trust-test.html
Normal file
Loading…
Add table
Add a link
Reference in a new issue