Merge pull request #1137 from nurtom/patch-1
Tests for issue #1124/#1125
This commit is contained in:
commit
03c6188989
2 changed files with 31 additions and 1 deletions
|
|
@ -1664,7 +1664,7 @@
|
|||
|
||||
var replaceHistory =
|
||||
(arguments.length === 3 ? arg2 : arg1) === true ||
|
||||
previousRoute === root
|
||||
previousRoute === currentRoute
|
||||
|
||||
if (global.history.pushState) {
|
||||
var method = replaceHistory ? "replaceState" : "pushState"
|
||||
|
|
|
|||
|
|
@ -838,6 +838,36 @@ describe("m.route()", function () {
|
|||
expect(mock.history.$$length).to.equal(0)
|
||||
})
|
||||
|
||||
dit("modify history when redirecting to same route with different parameters", function(root) {
|
||||
mode("search")
|
||||
mock.history.$$length = 0
|
||||
|
||||
route(root, "/a", {
|
||||
"/a": pure(function () { return "a" }),
|
||||
"/b": pure(function () { return "b" })
|
||||
})
|
||||
|
||||
route("/b")
|
||||
route("/b", { foo: "bar" })
|
||||
|
||||
expect(mock.history.$$length).to.equal(2)
|
||||
})
|
||||
|
||||
dit("doesn't modify history when redirecting to same route with same parameters", function(root) {
|
||||
mode("search")
|
||||
mock.history.$$length = 0
|
||||
|
||||
route(root, "/a", {
|
||||
"/a": pure(function () { return "a" }),
|
||||
"/b": pure(function () { return "b" })
|
||||
})
|
||||
|
||||
route("/b", { foo: "bar" })
|
||||
route("/b", { foo: "bar" })
|
||||
|
||||
expect(mock.history.$$length).to.equal(1)
|
||||
})
|
||||
|
||||
context("m.route.strategy() === \"all\", identical views", function () {
|
||||
context("parent nodes", function () {
|
||||
dit("renders routes independently", function (root) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue