fixing archiving
This commit is contained in:
parent
70b2489539
commit
c5f3bc23aa
37 changed files with 4279 additions and 37 deletions
|
|
@ -21,18 +21,25 @@ function testMithril(mock) {
|
|||
test(function() {return m("div", m("div")).attrs.tag === "div"}) //yes, this is expected behavior: see method signature
|
||||
|
||||
//m.module
|
||||
for (var i = 0; i < 2; i++) {
|
||||
//first iteration tests immediate rendering
|
||||
//second iteration tests deferred rendering
|
||||
test(function() {
|
||||
var root = mock.document.createElement("div")
|
||||
m.module(root, {
|
||||
controller: function() {this.value = "test"},
|
||||
view: function(ctrl) {return ctrl.value}
|
||||
})
|
||||
return root.childNodes[0].nodeValue === "test"
|
||||
test(function() {
|
||||
mock.performance.$elapse(50)
|
||||
|
||||
var root1 = mock.document.createElement("div")
|
||||
m.module(root1, {
|
||||
controller: function() {this.value = "test1"},
|
||||
view: function(ctrl) {return ctrl.value}
|
||||
})
|
||||
}
|
||||
|
||||
var root2 = mock.document.createElement("div")
|
||||
m.module(root2, {
|
||||
controller: function() {this.value = "test2"},
|
||||
view: function(ctrl) {return ctrl.value}
|
||||
})
|
||||
|
||||
mock.requestAnimationFrame.$resolve()
|
||||
|
||||
return root1.childNodes[0].nodeValue === "test1" && root2.childNodes[0].nodeValue === "test2"
|
||||
})
|
||||
|
||||
//m.withAttr
|
||||
test(function() {
|
||||
|
|
@ -107,6 +114,8 @@ function testMithril(mock) {
|
|||
|
||||
//m.route
|
||||
test(function() {
|
||||
mock.performance.$elapse(50)
|
||||
|
||||
var root = mock.document.createElement("div")
|
||||
m.route.mode = "search"
|
||||
m.route(root, "/test1", {
|
||||
|
|
@ -115,6 +124,8 @@ function testMithril(mock) {
|
|||
return mock.location.search == "?/test1" && root.childNodes[0].nodeValue === "foo"
|
||||
})
|
||||
test(function() {
|
||||
mock.performance.$elapse(50)
|
||||
|
||||
var root = mock.document.createElement("div")
|
||||
m.route.mode = "pathname"
|
||||
m.route(root, "/test2", {
|
||||
|
|
@ -123,6 +134,8 @@ function testMithril(mock) {
|
|||
return mock.location.pathname == "/test2" && root.childNodes[0].nodeValue === "foo"
|
||||
})
|
||||
test(function() {
|
||||
mock.performance.$elapse(50)
|
||||
|
||||
var root = mock.document.createElement("div")
|
||||
m.route.mode = "hash"
|
||||
m.route(root, "/test3", {
|
||||
|
|
@ -131,6 +144,8 @@ function testMithril(mock) {
|
|||
return mock.location.hash == "#/test3" && root.childNodes[0].nodeValue === "foo"
|
||||
})
|
||||
test(function() {
|
||||
mock.performance.$elapse(50)
|
||||
|
||||
var root = mock.document.createElement("div")
|
||||
m.route.mode = "search"
|
||||
m.route(root, "/test4/foo", {
|
||||
|
|
@ -207,12 +222,17 @@ function testMithril(mock) {
|
|||
|
||||
//m.startComputation/m.endComputation
|
||||
test(function() {
|
||||
mock.performance.$elapse(50)
|
||||
|
||||
var controller
|
||||
var root = mock.document.createElement("div")
|
||||
m.module(root, {
|
||||
controller: function() {controller = this},
|
||||
view: function(ctrl) {return ctrl.value}
|
||||
})
|
||||
|
||||
mock.performance.$elapse(50)
|
||||
|
||||
m.startComputation()
|
||||
controller.value = "foo"
|
||||
m.endComputation()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue