diff --git a/test/mithril.trust.js b/test/mithril.trust.js
index 17727a0d..0acd94fa 100644
--- a/test/mithril.trust.js
+++ b/test/mithril.trust.js
@@ -65,5 +65,21 @@ describe("m.trust()", function () {
expect(root.innerHTML)
.to.equal("
")
})
+
+ // https://github.com/lhorie/mithril.js/issues/1045
+ it("correctly injects script tags and executes them", function () {
+ var HTMLString =
+ ""
+ var root = document.createElement("div")
+ var child = document.createElement("div")
+ root.id = "root"
+ root.innerText = "Before"
+ root.appendChild(child)
+ document.body.appendChild(root)
+
+ m.render(child, m.trust(HTMLString))
+
+ expect(root.innerText).to.equal("After")
+ })
})
})