fix: m.route.param, not m.route.params 😓

This commit is contained in:
Pat Cavit 2017-01-11 15:14:29 -08:00
parent 2cdd8a96d1
commit d119accb21
2 changed files with 7 additions and 7 deletions

View file

@ -54,7 +54,7 @@ module.exports = function($window, redrawService) {
route.set(href, undefined, undefined) route.set(href, undefined, undefined)
} }
} }
route.params = function(key) { route.param = function(key) {
if(typeof attrs !== "undefined" && typeof key !== "undefined") return attrs[key] if(typeof attrs !== "undefined" && typeof key !== "undefined") return attrs[key]
return attrs return attrs
} }

View file

@ -1195,25 +1195,25 @@ o.spec("route", function() {
}, FRAME_BUDGET * 2) }, FRAME_BUDGET * 2)
}) })
o("m.route.params is available outside of route handlers", function(done) { o("m.route.param is available outside of route handlers", function(done) {
$window.location.href = prefix + "/" $window.location.href = prefix + "/"
route(root, "/1", { route(root, "/1", {
"/:id" : { "/:id" : {
view : function() { view : function() {
o(route.params("id")).equals("1") o(route.param("id")).equals("1")
return m("div") return m("div")
} }
} }
}) })
o(route.params("id")).equals(undefined); o(route.param("id")).equals(undefined);
o(route.params()).deepEquals(undefined); o(route.param()).deepEquals(undefined);
callAsync(function() { callAsync(function() {
o(route.params("id")).equals("1") o(route.param("id")).equals("1")
o(route.params()).deepEquals({id:"1"}) o(route.param()).deepEquals({id:"1"})
done() done()
}) })