can-route
Advanced tools
Comparing version 4.3.11 to 4.3.12
{ | ||
"name": "can-route", | ||
"version": "4.3.11", | ||
"version": "4.3.12", | ||
"description": "Observable front-end application routing for CanJS.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://canjs.com/doc/can-route.html", |
@@ -83,32 +83,37 @@ var canRoute = require('can-route'); | ||
setupRouteTest(function (iframe, iCanRoute, loc) { | ||
iCanRoute.start(); | ||
iCanRoute.register("{type}"); | ||
iCanRoute.register("{type}/{id}"); | ||
iCanRoute.attr({ | ||
type: "bar" | ||
}); | ||
setTimeout(function () { | ||
var after = loc.href.substr(loc.href.indexOf("#")); | ||
equal(after, "#!bar"); | ||
iCanRoute._onStartComplete = function () { | ||
iCanRoute.attr({ | ||
type: "bar", | ||
id: "\/" | ||
type: "bar" | ||
}); | ||
// check for 1 second | ||
var time = new Date(); | ||
setTimeout(function innerTimer() { | ||
setTimeout(function () { | ||
var after = loc.href.substr(loc.href.indexOf("#")); | ||
var isMatch = after === "#!bar/" + encodeURIComponent("\/"); | ||
var isWaitingTooLong = new Date() - time > 2000; | ||
if (isMatch || isWaitingTooLong) { | ||
equal(after, "#!bar/" + encodeURIComponent("\/"), "should go to type/id "+ (new Date() - time)); | ||
teardownRouteTest(); | ||
} else { | ||
setTimeout(innerTimer, 30); | ||
} | ||
}, 100); | ||
}, 100); | ||
equal(after, "#!bar"); | ||
iCanRoute.attr({ | ||
type: "bar", | ||
id: "\/" | ||
}); | ||
// check for 1 second | ||
var time = new Date(); | ||
setTimeout(function innerTimer() { | ||
var after = loc.href.substr(loc.href.indexOf("#")); | ||
var isMatch = after === "#!bar/" + encodeURIComponent("\/"); | ||
var isWaitingTooLong = new Date() - time > 5000; | ||
if (isMatch || isWaitingTooLong) { | ||
equal(after, "#!bar/" + encodeURIComponent("\/"), "should go to type/id "+ (new Date() - time)); | ||
teardownRouteTest(); | ||
} else { | ||
setTimeout(innerTimer, 30); | ||
} | ||
}, 30); | ||
}, 150); | ||
}; | ||
iCanRoute.start(); | ||
}); | ||
@@ -115,0 +120,0 @@ }); |
@@ -192,42 +192,2 @@ /* jshint asi:true */ | ||
test("unsticky routes", function () { | ||
setupRouteTest(function (iframe, iCanRoute, loc) { | ||
iCanRoute.start(); | ||
iCanRoute.register("{type}"); | ||
iCanRoute.register("{type}/{id}"); | ||
iCanRoute.attr({ | ||
type: "bar" | ||
}); | ||
setTimeout(function () { | ||
var after = loc.href.substr(loc.href.indexOf("#")); | ||
equal(after, "#!bar"); | ||
iCanRoute.attr({ | ||
type: "bar", | ||
id: "\/" | ||
}); | ||
// check for 1 second | ||
var time = new Date() | ||
setTimeout(function innerTimer() { | ||
var after = loc.href.substr(loc.href.indexOf("#")); | ||
if (after === "#!bar/" + encodeURIComponent("\/")) { | ||
equal(after, "#!bar/" + encodeURIComponent("\/"), "should go to type/id"); | ||
teardownRouteTest(); | ||
} else if (new Date() - time > 2000) { | ||
ok(false, "hash is " + after); | ||
can.remove(can.$(iframe)) | ||
} else { | ||
setTimeout(innerTimer, 30) | ||
} | ||
}, 100); | ||
}, 100); | ||
}); | ||
}); | ||
test("updating bound SimpleMap causes single update with a coerced string value", function() { | ||
@@ -234,0 +194,0 @@ expect(1); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
108751
2501