hash-brown-router
Advanced tools
Comparing version 3.3.0 to 3.3.1
@@ -0,1 +1,5 @@ | ||
# 3.3.1 | ||
- Fixed a bug where calling `evaluteCurrent('/')` when the current url was `/` wouldn't do anything [#56c207f0](https://github.com/TehShrike/hash-brown-router/commit/56c207f011600722f2a805f88ab2381eb55fde2f) | ||
# 3.3.0 | ||
@@ -2,0 +6,0 @@ |
@@ -52,3 +52,3 @@ var pathToRegexp = require('path-to-regexp-with-reversible-keys') | ||
path: chunks.shift(), | ||
queryString: qs.parse(chunks.join('')) | ||
queryString: qs.parse(chunks.join('')), | ||
} | ||
@@ -95,6 +95,7 @@ } | ||
function evaluateCurrentPathOrGoToDefault(routes, hashLocation, reverse, onNotFound, defaultPath) { | ||
const currentLocation = hashLocation.get() | ||
if (currentLocation && currentLocation !== '/') { | ||
var currentLocation = hashLocation.get() | ||
var canUseCurrentLocation = currentLocation && (currentLocation !== '/' || defaultPath === '/') | ||
if (canUseCurrentLocation) { | ||
var routesCopy = routes.slice() | ||
evaluateCurrentPath(routesCopy, hashLocation, reverse, onNotFound) | ||
@@ -101,0 +102,0 @@ } else { |
{ | ||
"name": "hash-brown-router", | ||
"version": "3.3.0", | ||
"version": "3.3.1", | ||
"description": "A client-side router that only cares about the bits after the #", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -247,2 +247,28 @@ var makeRouter = require('../') | ||
test('evaluateCurrent fires the / route when the url is currently /', function(t) { | ||
t.plan(1) | ||
startTest(function(getRoute) { | ||
var route = getRoute() | ||
route.on('not found', function(path, parameters) { | ||
t.fail('Should not fire the not found route') | ||
route.stop() | ||
t.end() | ||
}) | ||
route.add('/', function(parameters) { | ||
t.deepEqual(parameters, {}) | ||
route.stop() | ||
t.end() | ||
}) | ||
route.evaluateCurrent('/') | ||
}, '/') | ||
t.timeoutAfter(4000) | ||
}) | ||
test('replacing a url', function(t) { | ||
@@ -249,0 +275,0 @@ startTest(function(getRoute) { |
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
26271
585
13