White space cleanup
This commit is contained in:
parent
f0888ac7bd
commit
f9b358331e
1 changed files with 81 additions and 81 deletions
|
|
@ -38,7 +38,7 @@ o.spec("route", function() {
|
||||||
|
|
||||||
callAsync(function() {
|
callAsync(function() {
|
||||||
o(root.firstChild.nodeName).equals("DIV")
|
o(root.firstChild.nodeName).equals("DIV")
|
||||||
|
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
@ -55,11 +55,11 @@ o.spec("route", function() {
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
o(root.firstChild.nodeName).equals("DIV")
|
o(root.firstChild.nodeName).equals("DIV")
|
||||||
|
|
||||||
$window.history.back()
|
$window.history.back()
|
||||||
|
|
||||||
o($window.location.pathname).equals("/")
|
o($window.location.pathname).equals("/")
|
||||||
|
|
||||||
done()
|
done()
|
||||||
}, FRAME_BUDGET)
|
}, FRAME_BUDGET)
|
||||||
})
|
})
|
||||||
|
|
@ -77,7 +77,7 @@ o.spec("route", function() {
|
||||||
|
|
||||||
function init(vnode) {
|
function init(vnode) {
|
||||||
o(vnode.attrs.foo).equals(undefined)
|
o(vnode.attrs.foo).equals(undefined)
|
||||||
|
|
||||||
done()
|
done()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -219,11 +219,11 @@ o.spec("route", function() {
|
||||||
root.firstChild.dispatchEvent(e)
|
root.firstChild.dispatchEvent(e)
|
||||||
|
|
||||||
o($window.location.href).equals(env.protocol + "//" + (env.hostname === "/" ? "" : env.hostname) + slash + (prefix ? prefix + "/" : "") + "test")
|
o($window.location.href).equals(env.protocol + "//" + (env.hostname === "/" ? "" : env.hostname) + slash + (prefix ? prefix + "/" : "") + "test")
|
||||||
|
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
o("accepts RouteResolver", function(done) {
|
o("accepts RouteResolver", function(done) {
|
||||||
var matchCount = 0
|
var matchCount = 0
|
||||||
var renderCount = 0
|
var renderCount = 0
|
||||||
|
|
@ -232,37 +232,37 @@ o.spec("route", function() {
|
||||||
return m("div")
|
return m("div")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$window.location.href = prefix + "/"
|
$window.location.href = prefix + "/"
|
||||||
route(root, "/abc", {
|
route(root, "/abc", {
|
||||||
"/:id" : {
|
"/:id" : {
|
||||||
onmatch: function(vnode, resolve) {
|
onmatch: function(vnode, resolve) {
|
||||||
matchCount++
|
matchCount++
|
||||||
|
|
||||||
o(vnode.attrs.id).equals("abc")
|
o(vnode.attrs.id).equals("abc")
|
||||||
o(route.get()).equals("/abc")
|
o(route.get()).equals("/abc")
|
||||||
|
|
||||||
resolve(Component)
|
resolve(Component)
|
||||||
},
|
},
|
||||||
render: function(vnode) {
|
render: function(vnode) {
|
||||||
renderCount++
|
renderCount++
|
||||||
|
|
||||||
o(vnode.attrs.id).equals("abc")
|
o(vnode.attrs.id).equals("abc")
|
||||||
|
|
||||||
return vnode
|
return vnode
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
o(matchCount).equals(1)
|
o(matchCount).equals(1)
|
||||||
o(renderCount).equals(1)
|
o(renderCount).equals(1)
|
||||||
o(root.firstChild.nodeName).equals("DIV")
|
o(root.firstChild.nodeName).equals("DIV")
|
||||||
|
|
||||||
done()
|
done()
|
||||||
}, FRAME_BUDGET)
|
}, FRAME_BUDGET)
|
||||||
})
|
})
|
||||||
|
|
||||||
o("accepts RouteResolver without `render` method as payload", function(done) {
|
o("accepts RouteResolver without `render` method as payload", function(done) {
|
||||||
var matchCount = 0
|
var matchCount = 0
|
||||||
var Component = {
|
var Component = {
|
||||||
|
|
@ -270,30 +270,30 @@ o.spec("route", function() {
|
||||||
return m("div")
|
return m("div")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$window.location.href = prefix + "/"
|
$window.location.href = prefix + "/"
|
||||||
route(root, "/abc", {
|
route(root, "/abc", {
|
||||||
"/:id" : {
|
"/:id" : {
|
||||||
onmatch: function(vnode, resolve) {
|
onmatch: function(vnode, resolve) {
|
||||||
matchCount++
|
matchCount++
|
||||||
|
|
||||||
o(vnode.attrs.id).equals("abc")
|
o(vnode.attrs.id).equals("abc")
|
||||||
o(route.get()).equals("/abc")
|
o(route.get()).equals("/abc")
|
||||||
|
|
||||||
resolve(Component)
|
resolve(Component)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
o(matchCount).equals(1)
|
o(matchCount).equals(1)
|
||||||
|
|
||||||
o(root.firstChild.nodeName).equals("DIV")
|
o(root.firstChild.nodeName).equals("DIV")
|
||||||
|
|
||||||
done()
|
done()
|
||||||
}, FRAME_BUDGET)
|
}, FRAME_BUDGET)
|
||||||
})
|
})
|
||||||
|
|
||||||
o("accepts RouteResolver without `onmatch` method as payload", function(done) {
|
o("accepts RouteResolver without `onmatch` method as payload", function(done) {
|
||||||
var renderCount = 0
|
var renderCount = 0
|
||||||
var Component = {
|
var Component = {
|
||||||
|
|
@ -301,37 +301,37 @@ o.spec("route", function() {
|
||||||
return m("div")
|
return m("div")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$window.location.href = prefix + "/"
|
$window.location.href = prefix + "/"
|
||||||
route(root, "/abc", {
|
route(root, "/abc", {
|
||||||
"/:id" : {
|
"/:id" : {
|
||||||
render: function(vnode) {
|
render: function(vnode) {
|
||||||
renderCount++
|
renderCount++
|
||||||
|
|
||||||
o(vnode.attrs.id).equals("abc")
|
o(vnode.attrs.id).equals("abc")
|
||||||
|
|
||||||
return m(Component)
|
return m(Component)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
o(root.firstChild.nodeName).equals("DIV")
|
o(root.firstChild.nodeName).equals("DIV")
|
||||||
|
|
||||||
done()
|
done()
|
||||||
}, FRAME_BUDGET)
|
}, FRAME_BUDGET)
|
||||||
})
|
})
|
||||||
|
|
||||||
o("RouteResolver `render` does not have component semantics", function(done, timeout) {
|
o("RouteResolver `render` does not have component semantics", function(done, timeout) {
|
||||||
timeout(60)
|
timeout(60)
|
||||||
|
|
||||||
var renderCount = 0
|
var renderCount = 0
|
||||||
var A = {
|
var A = {
|
||||||
view: function() {
|
view: function() {
|
||||||
return m("div")
|
return m("div")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$window.location.href = prefix + "/"
|
$window.location.href = prefix + "/"
|
||||||
route(root, "/a", {
|
route(root, "/a", {
|
||||||
"/a" : {
|
"/a" : {
|
||||||
|
|
@ -345,16 +345,16 @@ o.spec("route", function() {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
var dom = root.firstChild
|
var dom = root.firstChild
|
||||||
o(root.firstChild.nodeName).equals("DIV")
|
o(root.firstChild.nodeName).equals("DIV")
|
||||||
|
|
||||||
route.set("/b")
|
route.set("/b")
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
o(root.firstChild).equals(dom)
|
o(root.firstChild).equals(dom)
|
||||||
|
|
||||||
done()
|
done()
|
||||||
}, FRAME_BUDGET)
|
}, FRAME_BUDGET)
|
||||||
}, FRAME_BUDGET)
|
}, FRAME_BUDGET)
|
||||||
|
|
@ -368,7 +368,7 @@ o.spec("route", function() {
|
||||||
return m("div")
|
return m("div")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$window.location.href = prefix + "/"
|
$window.location.href = prefix + "/"
|
||||||
route(root, "/", {
|
route(root, "/", {
|
||||||
"/" : {
|
"/" : {
|
||||||
|
|
@ -386,66 +386,66 @@ o.spec("route", function() {
|
||||||
callAsync(function() {
|
callAsync(function() {
|
||||||
o(matchCount).equals(1)
|
o(matchCount).equals(1)
|
||||||
o(renderCount).equals(1)
|
o(renderCount).equals(1)
|
||||||
|
|
||||||
redraw.publish()
|
redraw.publish()
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
o(matchCount).equals(1)
|
o(matchCount).equals(1)
|
||||||
o(renderCount).equals(2)
|
o(renderCount).equals(2)
|
||||||
|
|
||||||
done()
|
done()
|
||||||
}, FRAME_BUDGET)
|
}, FRAME_BUDGET)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
o("onmatch can redirect to another route", function(done) {
|
o("onmatch can redirect to another route", function(done) {
|
||||||
var redirected = false
|
var redirected = false
|
||||||
|
|
||||||
$window.location.href = prefix + "/"
|
$window.location.href = prefix + "/"
|
||||||
route(root, "/a", {
|
route(root, "/a", {
|
||||||
"/a" : {
|
"/a" : {
|
||||||
onmatch: function() {
|
onmatch: function() {
|
||||||
route.set("/b")
|
route.set("/b")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/b" : {
|
"/b" : {
|
||||||
view: function(vnode){
|
view: function(vnode){
|
||||||
redirected = true
|
redirected = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
o(redirected).equals(true)
|
o(redirected).equals(true)
|
||||||
|
|
||||||
|
done()
|
||||||
|
}, FRAME_BUDGET)
|
||||||
|
})
|
||||||
|
|
||||||
done()
|
|
||||||
}, FRAME_BUDGET)
|
|
||||||
})
|
|
||||||
|
|
||||||
o("onmatch can redirect to another route that has RouteResolver", function(done) {
|
o("onmatch can redirect to another route that has RouteResolver", function(done) {
|
||||||
var redirected = false
|
var redirected = false
|
||||||
|
|
||||||
$window.location.href = prefix + "/"
|
$window.location.href = prefix + "/"
|
||||||
route(root, "/a", {
|
route(root, "/a", {
|
||||||
"/a" : {
|
"/a" : {
|
||||||
onmatch: function() {
|
onmatch: function() {
|
||||||
route.set("/b")
|
route.set("/b")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/b" : {
|
"/b" : {
|
||||||
render: function(vnode){
|
render: function(vnode){
|
||||||
redirected = true
|
redirected = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
o(redirected).equals(true)
|
o(redirected).equals(true)
|
||||||
|
|
||||||
|
done()
|
||||||
|
}, FRAME_BUDGET)
|
||||||
|
})
|
||||||
|
|
||||||
done()
|
|
||||||
}, FRAME_BUDGET)
|
|
||||||
})
|
|
||||||
|
|
||||||
o("onmatch resolution callback resolves at most once", function(done) {
|
o("onmatch resolution callback resolves at most once", function(done) {
|
||||||
var resolveCount = 0
|
var resolveCount = 0
|
||||||
var resolvedComponent
|
var resolvedComponent
|
||||||
|
|
@ -474,10 +474,10 @@ o.spec("route", function() {
|
||||||
done()
|
done()
|
||||||
}, FRAME_BUDGET)
|
}, FRAME_BUDGET)
|
||||||
})
|
})
|
||||||
|
|
||||||
o("calling route.set invalidates pending onmatch resolution", function(done, timeout) {
|
o("calling route.set invalidates pending onmatch resolution", function(done, timeout) {
|
||||||
timeout(100)
|
timeout(100)
|
||||||
|
|
||||||
var resolved
|
var resolved
|
||||||
$window.location.href = prefix + "/"
|
$window.location.href = prefix + "/"
|
||||||
route(root, "/a", {
|
route(root, "/a", {
|
||||||
|
|
@ -493,7 +493,7 @@ o.spec("route", function() {
|
||||||
})
|
})
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
route.set("/b")
|
route.set("/b")
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
o(resolved).equals("b")
|
o(resolved).equals("b")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue