diff --git a/spec/html/QueryStringSpec.js b/spec/html/QueryStringSpec.js index 3779eaec..d4cd691a 100644 --- a/spec/html/QueryStringSpec.js +++ b/spec/html/QueryStringSpec.js @@ -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() {