Add spec to verify custom query params are left alone

[#29578495]
This commit is contained in:
slackersoft
2014-12-05 08:12:42 -08:00
parent 02161b7d48
commit ba9c863de9

View File

@@ -1,7 +1,6 @@
describe("QueryString", function() {
describe("#setParam", function() {
it("sets the query string to include the given key/value pair", function() {
var windowLocation = {
search: ""
@@ -14,6 +13,20 @@ describe("QueryString", function() {
expect(windowLocation.search).toMatch(/foo=bar%20baz/);
});
it("leaves existing params alone", function() {
var windowLocation = {
search: "?foo=bar"
},
queryString = new j$.QueryString({
getWindowLocation: function() { return windowLocation }
});
queryString.setParam("baz", "quux");
expect(windowLocation.search).toMatch(/foo=bar/);
expect(windowLocation.search).toMatch(/baz=quux/);
});
});
describe("#getParam", function() {