diff options
| author | Igor Minar | 2011-12-07 07:53:57 -0800 |
|---|---|---|
| committer | Igor Minar | 2011-12-07 07:54:09 -0800 |
| commit | fd38655e6c8e58e7c7325b2a5937b26174ebdefa (patch) | |
| tree | 03921a8a9dc94fe3f5c2752ea84e05682da3b89f /test | |
| parent | b9001e914740ea0e3bba357a33ddaf13610c874f (diff) | |
| download | angular.js-fd38655e6c8e58e7c7325b2a5937b26174ebdefa.tar.bz2 | |
fix(): use angular.callbacks namespace for jsonp callbacks
Previously we used to put callbacks on the window object, but that
causes problems on IE8 where it is not possible to delete properties
from the window object
Diffstat (limited to 'test')
| -rw-r--r-- | test/service/httpBackendSpec.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/service/httpBackendSpec.js b/test/service/httpBackendSpec.js index ccd9e4b6..b9bf2b18 100644 --- a/test/service/httpBackendSpec.js +++ b/test/service/httpBackendSpec.js @@ -1,6 +1,6 @@ describe('$httpBackend', function() { - var $backend, $browser, $window, + var $backend, $browser, callbacks, xhr, fakeBody, callback; // TODO(vojta): should be replaced by $defer mock @@ -19,10 +19,10 @@ describe('$httpBackend', function() { beforeEach(inject(function($injector) { - $window = {}; + callbacks = {}; $browser = $injector.get('$browser'); fakeBody = {removeChild: jasmine.createSpy('body.removeChild')}; - $backend = createHttpBackend($browser, MockXhr, fakeTimeout, $window, fakeBody); + $backend = createHttpBackend($browser, MockXhr, fakeTimeout, callbacks, fakeBody); callback = jasmine.createSpy('done'); })); @@ -135,7 +135,7 @@ describe('$httpBackend', function() { url = script.url.split('?cb='); expect(url[0]).toBe('http://example.org/path'); - $window[url[1]]('some-data'); + callbacks[url[1]]('some-data'); script.done(); expect(callback).toHaveBeenCalledOnce(); @@ -149,10 +149,10 @@ describe('$httpBackend', function() { var script = $browser.$$scripts.shift(), callbackId = script.url.split('?cb=')[1]; - $window[callbackId]('some-data'); + callbacks[callbackId]('some-data'); script.done(); - expect($window[callbackId]).toBeUndefined(); + expect(callbacks[callbackId]).toBeUndefined(); expect(fakeBody.removeChild).toHaveBeenCalledOnce(); expect(fakeBody.removeChild).toHaveBeenCalledWith(script); }); |
