From f9b358331e3276c47634bffc2d39adb3e794466f Mon Sep 17 00:00:00 2001 From: Pierre-Yves Gerardy Date: Thu, 1 Sep 2016 20:17:05 +0200 Subject: [PATCH] White space cleanup --- api/tests/test-router.js | 162 +++++++++++++++++++-------------------- 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/api/tests/test-router.js b/api/tests/test-router.js index d62c28b9..77098b9d 100644 --- a/api/tests/test-router.js +++ b/api/tests/test-router.js @@ -38,7 +38,7 @@ o.spec("route", function() { callAsync(function() { o(root.firstChild.nodeName).equals("DIV") - + done() }) }) @@ -55,11 +55,11 @@ o.spec("route", function() { setTimeout(function() { o(root.firstChild.nodeName).equals("DIV") - + $window.history.back() - + o($window.location.pathname).equals("/") - + done() }, FRAME_BUDGET) }) @@ -77,7 +77,7 @@ o.spec("route", function() { function init(vnode) { o(vnode.attrs.foo).equals(undefined) - + done() } }) @@ -219,11 +219,11 @@ o.spec("route", function() { root.firstChild.dispatchEvent(e) o($window.location.href).equals(env.protocol + "//" + (env.hostname === "/" ? "" : env.hostname) + slash + (prefix ? prefix + "/" : "") + "test") - + done() }) }) - + o("accepts RouteResolver", function(done) { var matchCount = 0 var renderCount = 0 @@ -232,37 +232,37 @@ o.spec("route", function() { return m("div") } } - + $window.location.href = prefix + "/" route(root, "/abc", { "/:id" : { onmatch: function(vnode, resolve) { matchCount++ - + o(vnode.attrs.id).equals("abc") o(route.get()).equals("/abc") - + resolve(Component) }, render: function(vnode) { renderCount++ - + o(vnode.attrs.id).equals("abc") - + return vnode }, }, }) - + setTimeout(function() { o(matchCount).equals(1) o(renderCount).equals(1) o(root.firstChild.nodeName).equals("DIV") - + done() }, FRAME_BUDGET) }) - + o("accepts RouteResolver without `render` method as payload", function(done) { var matchCount = 0 var Component = { @@ -270,30 +270,30 @@ o.spec("route", function() { return m("div") } } - + $window.location.href = prefix + "/" route(root, "/abc", { "/:id" : { onmatch: function(vnode, resolve) { matchCount++ - + o(vnode.attrs.id).equals("abc") o(route.get()).equals("/abc") - + resolve(Component) }, }, }) - + setTimeout(function() { o(matchCount).equals(1) - + o(root.firstChild.nodeName).equals("DIV") - + done() }, FRAME_BUDGET) }) - + o("accepts RouteResolver without `onmatch` method as payload", function(done) { var renderCount = 0 var Component = { @@ -301,37 +301,37 @@ o.spec("route", function() { return m("div") } } - + $window.location.href = prefix + "/" route(root, "/abc", { "/:id" : { render: function(vnode) { renderCount++ - + o(vnode.attrs.id).equals("abc") - + return m(Component) }, }, }) - + setTimeout(function() { o(root.firstChild.nodeName).equals("DIV") - + done() }, FRAME_BUDGET) }) - + o("RouteResolver `render` does not have component semantics", function(done, timeout) { timeout(60) - + var renderCount = 0 var A = { view: function() { return m("div") } } - + $window.location.href = prefix + "/" route(root, "/a", { "/a" : { @@ -345,16 +345,16 @@ o.spec("route", function() { }, }, }) - + setTimeout(function() { var dom = root.firstChild o(root.firstChild.nodeName).equals("DIV") - + route.set("/b") - + setTimeout(function() { o(root.firstChild).equals(dom) - + done() }, FRAME_BUDGET) }, FRAME_BUDGET) @@ -368,7 +368,7 @@ o.spec("route", function() { return m("div") } } - + $window.location.href = prefix + "/" route(root, "/", { "/" : { @@ -386,66 +386,66 @@ o.spec("route", function() { callAsync(function() { o(matchCount).equals(1) o(renderCount).equals(1) - + redraw.publish() setTimeout(function() { o(matchCount).equals(1) o(renderCount).equals(2) - + done() }, FRAME_BUDGET) }) }) - + o("onmatch can redirect to another route", function(done) { - var redirected = false + var redirected = false - $window.location.href = prefix + "/" - route(root, "/a", { - "/a" : { - onmatch: function() { - route.set("/b") - } - }, - "/b" : { - view: function(vnode){ - redirected = true - } - } - }) + $window.location.href = prefix + "/" + route(root, "/a", { + "/a" : { + onmatch: function() { + route.set("/b") + } + }, + "/b" : { + view: function(vnode){ + redirected = true + } + } + }) - setTimeout(function() { - o(redirected).equals(true) + setTimeout(function() { + o(redirected).equals(true) + + done() + }, FRAME_BUDGET) + }) - done() - }, FRAME_BUDGET) - }) - o("onmatch can redirect to another route that has RouteResolver", function(done) { - var redirected = false + var redirected = false - $window.location.href = prefix + "/" - route(root, "/a", { - "/a" : { - onmatch: function() { - route.set("/b") - } - }, - "/b" : { - render: function(vnode){ - redirected = true - } - } - }) + $window.location.href = prefix + "/" + route(root, "/a", { + "/a" : { + onmatch: function() { + route.set("/b") + } + }, + "/b" : { + render: function(vnode){ + redirected = true + } + } + }) - setTimeout(function() { - o(redirected).equals(true) + setTimeout(function() { + o(redirected).equals(true) + + done() + }, FRAME_BUDGET) + }) - done() - }, FRAME_BUDGET) - }) - o("onmatch resolution callback resolves at most once", function(done) { var resolveCount = 0 var resolvedComponent @@ -474,10 +474,10 @@ o.spec("route", function() { done() }, FRAME_BUDGET) }) - + o("calling route.set invalidates pending onmatch resolution", function(done, timeout) { timeout(100) - + var resolved $window.location.href = prefix + "/" route(root, "/a", { @@ -493,7 +493,7 @@ o.spec("route", function() { }) setTimeout(function() { route.set("/b") - + setTimeout(function() { o(resolved).equals("b")