describe("QueryString", function() {

  describe("#setParam", function() {

    it("sets the query string to include the given key/value pair", function() {
      var windowLocation = {
          search: ""
        },
        queryString = new j$.QueryString({
          getWindowLocation: function() { return windowLocation }
        });

      queryString.setParam("foo", "bar baz");

      expect(windowLocation.search).toMatch(/foo=bar%20baz/);
    });
  });

  describe("#getParam", function() {

    it("returns the value of the requested key", function() {
      var windowLocation = {
          search: "?baz=quux%20corge"
        },
        queryString = new j$.QueryString({
          getWindowLocation: function() { return windowLocation }
        });

      expect(queryString.getParam("baz")).toEqual("quux corge");
    });

    it("returns null if the key is not present", function() {
      var windowLocation = {
          search: ""
        },
        queryString = new j$.QueryString({
          getWindowLocation: function() { return windowLocation }
        });

      expect(queryString.getParam("baz")).toBeFalsy();
    });
  });
});

@@ -60,33 +60,32 @@
 %22, function() %7B%0A
-%0A
     it(%22sets the
@@ -375,24 +375,24 @@
 bar baz%22);%0A%0A
-
       expect
@@ -444,24 +444,423 @@
 z/);%0A    %7D);
+%0A%0A    it(%22leaves existing params alone%22, function() %7B%0A      var windowLocation = %7B%0A        search: %22?foo=bar%22%0A      %7D,%0A      queryString = new j$.QueryString(%7B%0A        getWindowLocation: function() %7B return windowLocation %7D%0A      %7D);%0A%0A      queryString.setParam(%22baz%22, %22quux%22);%0A%0A      expect(windowLocation.search).toMatch(/foo=bar/);%0A      expect(windowLocation.search).toMatch(/baz=quux/);%0A    %7D);
 %0A  %7D);%0A%0A  de

Add spec to verify custom query params are left alone