hash-brown-router
Advanced tools
Comparing version 1.5.2 to 1.5.3
@@ -32,3 +32,3 @@ var pathToRegexp = require('path-to-regexp-with-reversible-keys') | ||
stop: stop, | ||
evaluateCurrent: evaluateCurrentPathOrGoToDefault.bind(null, routes, hashLocation), | ||
evaluateCurrent: evaluateCurrentPathOrGoToDefault.bind(null, routes, hashLocation, !!opts.reverse), | ||
setDefault: setDefault.bind(null, routes), | ||
@@ -90,3 +90,3 @@ replace: hashLocation.replace, | ||
function evaluateCurrentPathOrGoToDefault(routes, hashLocation, defaultPath) { | ||
function evaluateCurrentPathOrGoToDefault(routes, hashLocation, reverse, defaultPath) { | ||
if (hashLocation.get()) { | ||
@@ -97,3 +97,3 @@ var routesCopy = routes.slice() | ||
} | ||
evaluateCurrentPath(routesCopy, hashLocation) | ||
evaluateCurrentPath(routesCopy, hashLocation, reverse) | ||
} else { | ||
@@ -100,0 +100,0 @@ hashLocation.go(defaultPath) |
{ | ||
"name": "hash-brown-router", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"description": "A client-side router that only cares about the bits after the #", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -297,2 +297,28 @@ var makeRouter = require('../') | ||
}) | ||
test('reverse order is respected for evaluateCurrent()', function(t) { | ||
// https://github.com/TehShrike/hash-brown-router/issues/8 | ||
getRoute(function(route) { | ||
locationHash.go('/route/butts') | ||
route.add('/route/:oneThing', function() { | ||
t.fail('the first route was called') | ||
route.stop() | ||
t.end() | ||
}) | ||
route.add('/route/:anotherThing', function() { | ||
t.pass('the second route was called') | ||
route.stop() | ||
t.end() | ||
}) | ||
setTimeout(function() { | ||
route.evaluateCurrent('/wat') | ||
}, 50) | ||
}, { reverse: true }) | ||
t.timeoutAfter(4000) | ||
}) | ||
} |
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
17970
412