create test for #290
This commit is contained in:
parent
67666e76dd
commit
1fa946110a
2 changed files with 15 additions and 3 deletions
|
|
@ -861,10 +861,20 @@ function testMithril(mock) {
|
||||||
var root = mock.document.createElement("div")
|
var root = mock.document.createElement("div")
|
||||||
m.route.mode = "pathname"
|
m.route.mode = "pathname"
|
||||||
m.route(root, "/test2", {
|
m.route(root, "/test2", {
|
||||||
"/test2": {controller: function() {}, view: function() {return "foo"}}
|
"/test2": {
|
||||||
|
controller: function() {},
|
||||||
|
view: function() {
|
||||||
|
return [
|
||||||
|
"foo",
|
||||||
|
m("a", { href: "/test2", config: m.route }, "Test2")
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
mock.requestAnimationFrame.$resolve() //teardown
|
mock.requestAnimationFrame.$resolve() //teardown
|
||||||
return mock.location.pathname == "/test2" && root.childNodes[0].nodeValue === "foo"
|
return mock.location.pathname == "/test2" &&
|
||||||
|
root.childNodes[0].nodeValue === "foo" &&
|
||||||
|
root.childNodes[1].href == "/test2"
|
||||||
})
|
})
|
||||||
test(function() {
|
test(function() {
|
||||||
mock.requestAnimationFrame.$resolve() //setup
|
mock.requestAnimationFrame.$resolve() //setup
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,9 @@ mock.window = new function() {
|
||||||
},
|
},
|
||||||
getAttribute: function(name, value) {
|
getAttribute: function(name, value) {
|
||||||
return this[name]
|
return this[name]
|
||||||
}
|
},
|
||||||
|
addEventListener: function () {},
|
||||||
|
removeEventListener: function () {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.document.createElementNS = function(namespace, tag) {
|
window.document.createElementNS = function(namespace, tag) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue