Added tests for history modification when switching routes with parameters (#1125)

This commit is contained in:
Thomas Erfurth 2016-07-06 10:54:46 +02:00
parent c17ea5bbc8
commit d6f7653e31

View file

@ -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) {