diff options
| author | Angel Balcarcel | 2013-08-09 10:29:22 -0400 |
|---|---|---|
| committer | Brian Ford | 2013-10-02 15:33:31 -0700 |
| commit | d70711481e6311c9cd283d650f07ca0cca72ecc2 (patch) | |
| tree | b8bc70a4bab8eb0a90897172513429271d671228 /test/ng | |
| parent | 78a5889bc691d95e5b037c99de3607f02a69a188 (diff) | |
| download | angular.js-d70711481e6311c9cd283d650f07ca0cca72ecc2.tar.bz2 | |
fix($location): prevent infinite digest error in IE7
Refactored `replacedUrl` to store the new URL on both
`location.replace` and setting `location.href` directly to handle
delays in the actual location value change in IE.
Closes #2802
Diffstat (limited to 'test/ng')
| -rwxr-xr-x | test/ng/browserSpecs.js | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/test/ng/browserSpecs.js b/test/ng/browserSpecs.js index 3ec78e61..6c6ac30e 100755 --- a/test/ng/browserSpecs.js +++ b/test/ng/browserSpecs.js @@ -287,7 +287,7 @@ describe('browser', function() { it('should default path in cookie to "" (empty string)', function () { browser.cookies('cookie', 'bender'); // This only fails in Safari and IE when cookiePath returns undefined - // Where it now succeeds since baseHref return '' instead of undefined + // Where it now succeeds since baseHref return '' instead of undefined expect(document.cookie).toEqual('cookie=bender'); }); }); @@ -535,9 +535,32 @@ describe('browser', function() { fakeWindow.setTimeout.flush(); expect(callback).toHaveBeenCalledWith('http://server.new'); + callback.reset(); + fakeWindow.fire('popstate'); fakeWindow.fire('hashchange'); - expect(callback).toHaveBeenCalledOnce(); + expect(callback).not.toHaveBeenCalled(); + }); + + describe('after an initial location change by browser.url method when neither history nor hashchange supported', function() { + beforeEach(function() { + sniffer.history = false; + sniffer.hashchange = false; + browser.url("http://server.current"); + }); + + it('should fire callback with the correct URL on location change outside of angular', function() { + browser.onUrlChange(callback); + + fakeWindow.location.href = 'http://server.new'; + fakeWindow.setTimeout.flush(); + expect(callback).toHaveBeenCalledWith('http://server.new'); + + fakeWindow.fire('popstate'); + fakeWindow.fire('hashchange'); + expect(callback).toHaveBeenCalledOnce(); + }); + }); it('should not fire urlChange if changed by browser.url method (polling)', function() { |
