diff --git a/api/tests/test-router.js b/api/tests/test-router.js index b0b5572c..6e620ca6 100644 --- a/api/tests/test-router.js +++ b/api/tests/test-router.js @@ -209,6 +209,23 @@ o.spec("route", function() { ) }) + o("keeps trailing / in rest parameterized route", function() { + $window.location.href = prefix + "/test/d/" + route(root, "/test/:a...", { + "/test/:a..." : { + view: lock(function(vnode) { + return JSON.stringify(route.param()) + " " + + JSON.stringify(vnode.attrs) + " " + + route.get() + }) + } + }) + + o(root.firstChild.nodeValue).equals( + '{"a":"d/"} {"a":"d/"} /test/d/' + ) + }) + o("handles route with search", function() { $window.location.href = prefix + "/test?a=b&c=d" route(root, "/test", { diff --git a/pathname/parse.js b/pathname/parse.js index 4472c833..a7e97fae 100644 --- a/pathname/parse.js +++ b/pathname/parse.js @@ -13,7 +13,6 @@ module.exports = function(url) { if (!path) path = "/" else { if (path[0] !== "/") path = "/" + path - if (path.length > 1 && path[path.length - 1] === "/") path = path.slice(0, -1) } return { path: path, diff --git a/pathname/tests/test-parsePathname.js b/pathname/tests/test-parsePathname.js index b81d34f1..03d7c1b6 100644 --- a/pathname/tests/test-parsePathname.js +++ b/pathname/tests/test-parsePathname.js @@ -112,7 +112,7 @@ o.spec("parsePathname", function() { o("parses route + query, ignores hash with lots of junk slashes", function() { var data = parsePathname("//route/////foo//?a=1&b=2#c=3&d=4") o(data).deepEquals({ - path: "/route/foo", + path: "/route/foo/", params: {a: "1", b: "2"} }) })