hash-brown-router
Advanced tools
Comparing version 3.0.2 to 3.1.0
@@ -0,1 +1,9 @@ | ||
# 3.0.2 | ||
- compatibility: changed `require('events').EventEmitter` to `require('events')` for better Rollup compatibility [#b01c88cd](https://github.com/TehShrike/hash-brown-router/commit/b01c88cd7ad2a915800ed21257bb2a3674b91a50) | ||
# 3.0.1 | ||
- Documentation: adding an example to the readme [#16](https://github.com/TehShrike/hash-brown-router/pull/16) | ||
# 3.0.0 | ||
@@ -2,0 +10,0 @@ |
@@ -95,3 +95,4 @@ var pathToRegexp = require('path-to-regexp-with-reversible-keys') | ||
function evaluateCurrentPathOrGoToDefault(routes, hashLocation, reverse, onNotFound, defaultPath) { | ||
if (hashLocation.get()) { | ||
const currentLocation = hashLocation.get() | ||
if (currentLocation && currentLocation !== '/') { | ||
var routesCopy = routes.slice() | ||
@@ -98,0 +99,0 @@ |
{ | ||
"name": "hash-brown-router", | ||
"version": "3.0.2", | ||
"version": "3.1.0", | ||
"description": "A client-side router that only cares about the bits after the #", | ||
@@ -10,4 +10,2 @@ "main": "index.js", | ||
"watch": "watchify test/browser-test.js -o browser-test.js -d", | ||
"browserstackbuild": "browserify test/browser-test.js node_modules/browserstack-tape-reporter/index.js -o browser-test.js -d", | ||
"browserstack": "npm run browserstackbuild && browserstack-runner", | ||
"browser": "browserify test/browser-test.js | tape-run" | ||
@@ -33,5 +31,4 @@ }, | ||
"devDependencies": { | ||
"browser-run": "3.5.0", | ||
"browserify": "~11.0.0", | ||
"browserstack-runner": "0.4.4", | ||
"browserstack-tape-reporter": "~1.0.0", | ||
"tap-browser-color": "^0.1.2", | ||
@@ -38,0 +35,0 @@ "tape": "~4.1.0", |
@@ -9,6 +9,5 @@ var makeRouter = require('../') | ||
function startTest(cb) { | ||
locationHash.go('') | ||
function startTest(cb, startingLocation) { | ||
locationHash.go(startingLocation || '') | ||
setTimeout(function() { | ||
cb(getRoute) | ||
@@ -90,3 +89,2 @@ }, delayAfterInitialRouteChange || 0) | ||
route.evaluateCurrent() | ||
}, 1000) | ||
@@ -211,3 +209,2 @@ }) | ||
t.timeoutAfter(4000) | ||
}) | ||
@@ -234,2 +231,21 @@ | ||
test('evaluateCurrent works correctly when explicitly starting at route /', function(t) { | ||
startTest(function(getRoute) { | ||
var route = getRoute() | ||
route.on('not found', function(path, parameters) { | ||
t.equal(typeof parameters, 'object', 'parameters object is an object') | ||
t.equal(parameters.lol, 'wut', 'value from the querystring was passed in') | ||
t.equal(path, '/default', 'the /default path was correctly passed in') | ||
route.stop() | ||
t.end() | ||
}) | ||
route.evaluateCurrent('/default?lol=wut') | ||
}, '/') | ||
t.timeoutAfter(4000) | ||
}) | ||
test('replacing a url', function(t) { | ||
@@ -256,3 +272,2 @@ startTest(function(getRoute) { | ||
route.go('/initial') | ||
}) | ||
@@ -274,3 +289,2 @@ | ||
} | ||
}) | ||
@@ -295,3 +309,2 @@ | ||
}, 50) | ||
}) | ||
@@ -321,3 +334,2 @@ | ||
}, 50) | ||
}) | ||
@@ -347,3 +359,2 @@ | ||
}, 50) | ||
}) | ||
@@ -376,3 +387,2 @@ | ||
}, 50) | ||
}) | ||
@@ -379,0 +389,0 @@ |
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
21915
6
19
457