diff options
| author | Caitlin Potter | 2014-01-24 16:25:40 -0500 | 
|---|---|---|
| committer | Caitlin Potter | 2014-02-21 18:31:13 -0500 | 
| commit | cad717b1171affc3d540cea372576c70b0cb2295 (patch) | |
| tree | 4c10aef63a229da36ff2b12be69ec964fd7b40b7 /test | |
| parent | c2d447e378dd72d1b955f476bd5bf249625b4dab (diff) | |
| download | angular.js-cad717b1171affc3d540cea372576c70b0cb2295.tar.bz2 | |
fix($location): parse query string when path is empty in hashbang mode
Before this fix, search queries in hashbang mode were ignored if the hash was not present in the
url. This patch corrects this by ensuring that the search query is available to be parsed by
urlResolve when the hashbang is not present.
Closes #5964
Diffstat (limited to 'test')
| -rw-r--r-- | test/ng/locationSpec.js | 24 | 
1 files changed, 24 insertions, 0 deletions
| diff --git a/test/ng/locationSpec.js b/test/ng/locationSpec.js index ff823d30..8ff5da30 100644 --- a/test/ng/locationSpec.js +++ b/test/ng/locationSpec.js @@ -1487,6 +1487,30 @@ describe('$location', function() {        expect(location.url()).toBe('/not-starting-with-slash');        expect(location.absUrl()).toBe('http://server/pre/index.html#/not-starting-with-slash');      }); + +    describe("search()", function() { +      it("should return a populated search object for search query when path is empty", function() { +        location = new LocationHashbangUrl('http://server/pre/index.html', '!'); + +        location.$$parse('http://server/pre/?foo=1&bar=2&baz=3'); +        expect(location.path()).toBe(''); +        expect(location.absUrl()).toBe('http://server/pre/index.html?foo=1&bar=2&baz=3') +        expect(location.search()).toEqual({ +          foo: '1', +          bar: '2', +          baz: '3' +        }); + +        location.$$parse('http://server/pre/index.html?foo=1&bar=2&baz=3'); +        expect(location.path()).toBe(''); +        expect(location.absUrl()).toBe('http://server/pre/index.html?foo=1&bar=2&baz=3') +        expect(location.search()).toEqual({ +          foo: '1', +          bar: '2', +          baz: '3' +        }); +      }); +    });    }); | 
