Merge branch 'typeof_refactor' of github.com:Naddiseo/mithril.js into Naddiseo-typeof_refactor
Conflicts: mithril.js tests/mithril-tests.js
This commit is contained in:
commit
d993da1cfd
2 changed files with 120 additions and 31 deletions
|
|
@ -154,6 +154,18 @@ function testMithril(mock) {
|
|||
m.render(root, m("ul", [{}]))
|
||||
return root.childNodes[0].childNodes.length === 0
|
||||
})
|
||||
test(function() {
|
||||
var root = mock.document.createElement("div")
|
||||
m.render(root, m("ul", [m("li")]))
|
||||
m.render(root, m("ul", [{tag: "b", attrs: {}}]))
|
||||
return root.childNodes[0].childNodes[0].nodeName == "B"
|
||||
})
|
||||
test(function() {
|
||||
var root = mock.document.createElement("div")
|
||||
m.render(root, m("ul", [m("li")]))
|
||||
m.render(root, m("ul", [{tag: new String("b"), attrs: {}}]))
|
||||
return root.childNodes[0].childNodes[0].nodeName == "B"
|
||||
})
|
||||
test(function() {
|
||||
var root = mock.document.createElement("div")
|
||||
m.render(root, m("ul", [m("li", [m("a")])]))
|
||||
|
|
@ -763,6 +775,15 @@ function testMithril(mock) {
|
|||
m.render(root, new Field())
|
||||
return root.childNodes.length == 1
|
||||
})
|
||||
test(function() {
|
||||
var root = mock.document.createElement("div")
|
||||
m.render(root, m("ul", [m("li")]))
|
||||
var change = function() {
|
||||
m.render(root, m("ul", arguments))
|
||||
}
|
||||
change(m("b"));
|
||||
return root.childNodes[0].childNodes[0].nodeName == "B"
|
||||
})
|
||||
//end m.render
|
||||
|
||||
//m.redraw
|
||||
|
|
@ -1486,6 +1507,68 @@ function testMithril(mock) {
|
|||
})
|
||||
return value == "foo+bar"
|
||||
})
|
||||
test(function() {
|
||||
mock.requestAnimationFrame.$resolve() //setup
|
||||
mock.location.search = "?"
|
||||
|
||||
var root = mock.document.createElement("div")
|
||||
m.route.mode = "search"
|
||||
m.route(root, "/", {
|
||||
"/": {controller: function() {}, view: function() {return "foo"}},
|
||||
"/test22": {controller: function() {}, view: function() {return "bar"}}
|
||||
})
|
||||
mock.requestAnimationFrame.$resolve()
|
||||
m.route(String("/test22/"))
|
||||
mock.requestAnimationFrame.$resolve() //teardown
|
||||
return mock.location.search == "?/test22/" && root.childNodes[0].nodeValue === "bar"
|
||||
})
|
||||
test(function() {
|
||||
mock.requestAnimationFrame.$resolve() //setup
|
||||
mock.location.search = "?"
|
||||
|
||||
var root = mock.document.createElement("div")
|
||||
m.route.mode = "search"
|
||||
m.route(root, "/", {
|
||||
"/": {controller: function() {}, view: function() {return "foo"}},
|
||||
"/test23": {controller: function() {}, view: function() {return "bar"}}
|
||||
})
|
||||
mock.requestAnimationFrame.$resolve()
|
||||
m.route(new String("/test23/"))
|
||||
mock.requestAnimationFrame.$resolve() //teardown
|
||||
return mock.location.search == "?/test23/" && root.childNodes[0].nodeValue === "bar"
|
||||
})
|
||||
test(function() {
|
||||
mock.requestAnimationFrame.$resolve() //setup
|
||||
mock.location.search = "?"
|
||||
|
||||
var root = mock.document.createElement("div")
|
||||
var value
|
||||
m.route(root, String("/foo+bar"), {
|
||||
"/:arg": {
|
||||
controller: function() {value = m.route.param("arg")},
|
||||
view: function(ctrl) {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
})
|
||||
return value == "foo+bar"
|
||||
})
|
||||
test(function() {
|
||||
mock.requestAnimationFrame.$resolve() //setup
|
||||
mock.location.search = "?"
|
||||
|
||||
var root = mock.document.createElement("div")
|
||||
var value
|
||||
m.route(root, new String("/foo+bar"), {
|
||||
"/:arg": {
|
||||
controller: function() {value = m.route.param("arg")},
|
||||
view: function(ctrl) {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
})
|
||||
return value == "foo+bar"
|
||||
})
|
||||
//end m.route
|
||||
|
||||
//m.prop
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue