diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/angular-mocksSpec.js | 6 | ||||
| -rw-r--r-- | test/service/httpBackendSpec.js | 13 | ||||
| -rw-r--r-- | test/widgetsSpec.js | 1 | 
3 files changed, 10 insertions, 10 deletions
diff --git a/test/angular-mocksSpec.js b/test/angular-mocksSpec.js index 9c0bd681..054cabae 100644 --- a/test/angular-mocksSpec.js +++ b/test/angular-mocksSpec.js @@ -6,16 +6,14 @@ describe('mocks', function() {      describe('addJs', function() { -      it('should store url, id, done', inject(function($browser) { +      it('should store url, done', inject(function($browser) {          var url  = 'some.js', -            id   = 'js-id',              done = noop; -        $browser.addJs(url, id, done); +        $browser.addJs(url, done);          var script = $browser.$$scripts.shift();          expect(script.url).toBe(url); -        expect(script.id).toBe(id);          expect(script.done).toBe(done);        })); diff --git a/test/service/httpBackendSpec.js b/test/service/httpBackendSpec.js index 1c6d3a51..55d1a48a 100644 --- a/test/service/httpBackendSpec.js +++ b/test/service/httpBackendSpec.js @@ -19,7 +19,7 @@ describe('$httpBackend', function() {    beforeEach(inject(function($injector) { -    callbacks = {}; +    callbacks = {counter: 0};      $browser = $injector.get('$browser');      fakeBody = {removeChild: jasmine.createSpy('body.removeChild')};      $backend = createHttpBackend($browser, MockXhr, fakeTimeout, callbacks, fakeBody); @@ -115,6 +115,9 @@ describe('$httpBackend', function() {    describe('JSONP', function() { +    var SCRIPT_URL = /([^\?]*)\?cb=angular\.callbacks\.(.*)/; + +      it('should add script tag for JSONP request', function() {        callback.andCallFake(function(status, response) {          expect(status).toBe(200); @@ -125,10 +128,10 @@ describe('$httpBackend', function() {        expect($browser.$$scripts.length).toBe(1);        var script = $browser.$$scripts.shift(), -          url = script.url.split('?cb='); +          url = script.url.match(SCRIPT_URL); -      expect(url[0]).toBe('http://example.org/path'); -      callbacks[url[1]]('some-data'); +      expect(url[1]).toBe('http://example.org/path'); +      callbacks[url[2]]('some-data');        script.done();        expect(callback).toHaveBeenCalledOnce(); @@ -140,7 +143,7 @@ describe('$httpBackend', function() {        expect($browser.$$scripts.length).toBe(1);        var script = $browser.$$scripts.shift(), -          callbackId = script.url.split('?cb=')[1]; +          callbackId = script.url.match(SCRIPT_URL)[2];        callbacks[callbackId]('some-data');        script.done(); diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index 09d807b5..632724ce 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -244,7 +244,6 @@ describe('widget', function() {              $rootScope.tpl = template;              $rootScope.value = value;            }); -          $browser.defer.flush();          };        }  | 
