From fd38655e6c8e58e7c7325b2a5937b26174ebdefa Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 7 Dec 2011 07:53:57 -0800 Subject: 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 --- test/service/httpBackendSpec.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test') 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); }); -- cgit v1.2.3