diff --git a/api/router.js b/api/router.js index c182008f..93f2e074 100644 --- a/api/router.js +++ b/api/router.js @@ -39,7 +39,10 @@ module.exports = function($window, redrawService) { redrawService.subscribe(root, run) } route.set = function(path, data, options) { - if (lastUpdate != null) options = {replace: true} + if (lastUpdate != null) { + options = options || {} + options.replace = true + } lastUpdate = null routeService.setPath(path, data, options) } diff --git a/api/tests/test-router.js b/api/tests/test-router.js index 0b078e67..f0defd22 100644 --- a/api/tests/test-router.js +++ b/api/tests/test-router.js @@ -667,7 +667,7 @@ o.spec("route", function() { route(root, "/a", { "/a" : { onmatch: function() { - route.set("/b") + route.set("/b", {}, {state: {a: 5}}) }, render: render }, @@ -686,6 +686,7 @@ o.spec("route", function() { o(view.callCount).equals(1) o(root.childNodes.length).equals(1) o(root.firstChild.nodeName).equals("DIV") + o($window.history.state).deepEquals({a: 5}) done() })