Adds test

This commit is contained in:
John Long 2016-01-05 15:03:52 -07:00
parent 2cc898877d
commit aad2fc3e33
2 changed files with 12 additions and 0 deletions

View file

@ -20,6 +20,7 @@ describe("m.trust()", function () {
// FIXME: implement document.createRange().createContextualFragment() in the
// mock window for these tests
dom(function () {
it("isn't escaped in m.render()", function () {
var root = document.createElement("div")
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")
})
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>&amp;copy;</p><p>©</p>©</div>")
})
})
})

0
tests/trust-test.html Normal file
View file