changed the tests to expect that m.module returns the instance of module.controller that was passed to it

This commit is contained in:
C. James Winslow 2014-09-10 16:20:42 -07:00
parent 343687d5f2
commit 445087c606

View file

@ -34,20 +34,21 @@ function testMithril(mock) {
mock.requestAnimationFrame.$resolve() mock.requestAnimationFrame.$resolve()
var root1 = mock.document.createElement("div") var root1 = mock.document.createElement("div")
m.module(root1, { var mod1 = m.module(root1, {
controller: function() {this.value = "test1"}, controller: function() {this.value = "test1"},
view: function(ctrl) {return ctrl.value} view: function(ctrl) {return ctrl.value}
}) })
var root2 = mock.document.createElement("div") var root2 = mock.document.createElement("div")
m.module(root2, { var mod2 = m.module(root2, {
controller: function() {this.value = "test2"}, controller: function() {this.value = "test2"},
view: function(ctrl) {return ctrl.value} view: function(ctrl) {return ctrl.value}
}) })
mock.requestAnimationFrame.$resolve() mock.requestAnimationFrame.$resolve()
return root1.childNodes[0].nodeValue === "test1" && root2.childNodes[0].nodeValue === "test2" return (root1.childNodes[0].nodeValue === "test1" && root2.childNodes[0].nodeValue === "test2")
&& (mod1.value && mod1.value === "test1") && (mod2.value && mod2.value === "test2")
}) })
//m.withAttr //m.withAttr