diff options
| author | Vojta Jina | 2011-11-10 11:11:43 -0800 | 
|---|---|---|
| committer | Misko Hevery | 2011-11-14 20:31:17 -0800 | 
| commit | 5279de0e70e4f7c9c9607691c34b79d8c675695a (patch) | |
| tree | 5378dbf7f49f7b51ff8012400e48f9d8881afd1a /test/service/locationSpec.js | |
| parent | 8fe77b69e8008c6a432f9ef226586a09deb48c6c (diff) | |
| download | angular.js-5279de0e70e4f7c9c9607691c34b79d8c675695a.tar.bz2 | |
fix($location): links without path segment should not change the path
Closes #648
Diffstat (limited to 'test/service/locationSpec.js')
| -rw-r--r-- | test/service/locationSpec.js | 27 | 
1 files changed, 27 insertions, 0 deletions
| diff --git a/test/service/locationSpec.js b/test/service/locationSpec.js index 30c3f790..7c075fc0 100644 --- a/test/service/locationSpec.js +++ b/test/service/locationSpec.js @@ -95,6 +95,33 @@ describe('$location', function() {      }); +    it('url() should change only hash when no search and path specified', function() { +      url.url('#some-hash'); + +      expect(url.hash()).toBe('some-hash'); +      expect(url.url()).toBe('/path/b?search=a&b=c&d#some-hash'); +      expect(url.absUrl()).toBe('http://www.domain.com:9877/path/b?search=a&b=c&d#some-hash'); +    }); + + +    it('url() should change only search and hash when no path specified', function() { +      url.url('?a=b'); + +      expect(url.search()).toEqual({a: 'b'}); +      expect(url.hash()).toBe(''); +      expect(url.path()).toBe('/path/b'); +    }); + + +    it('url() should reset search and hash when only path specified', function() { +      url.url('/new/path'); + +      expect(url.path()).toBe('/new/path'); +      expect(url.search()).toEqual({}); +      expect(url.hash()).toBe(''); +    }); + +      it('replace should set $$replace flag and return itself', function() {        expect(url.$$replace).toBe(false); | 
