diff --git a/package.json b/package.json index 51697ff..e1b493a 100644 --- a/package.json +++ b/package.json @@ -14,26 +14,27 @@ }, "dependencies": {}, "devDependencies": { - "grunt": "~0.4.4", - "phantomjs": "~1.9.1-0", - "grunt-contrib-concat": "~0.3.0", - "grunt-contrib-jshint": "~0.6.2", - "grunt-contrib-uglify": "~0.2.2", - "grunt-contrib-copy": "~0.5.0", - "grunt-contrib-connect": "~0.6.0", - "grunt-contrib-clean": "~0.5.0", - "grunt-karma": "~0.8.2", - "jshint": "~2.5.0", - "karma-script-launcher": "~0.1.0", - "karma-html2js-preprocessor": "~0.1.0", - "karma-phantomjs-launcher": "~0.1.4", - "karma-chrome-launcher": "~0.1.3", - "karma-firefox-launcher": "~0.1.3", - "karma-jasmine": "~0.1.5", - "karma-requirejs": "~0.2.0", - "karma-coffee-preprocessor": "~0.2.1", - "karma": "~0.12.5", - "karma-coverage": "~0.2.1", + "grunt": "~1.0.1", + "grunt-contrib-clean": "~1.0.0", + "grunt-contrib-concat": "~1.0.1", + "grunt-contrib-connect": "~1.0.2", + "grunt-contrib-copy": "~1.0.0", + "grunt-contrib-jshint": "~1.1.0", + "grunt-contrib-uglify": "~2.0.0", + "grunt-karma": "~2.0.0", + "jasmine-core": "2.5.2", + "jshint": "~2.9.4", + "karma": "~1.3.0", + "karma-chrome-launcher": "~2.0.0", + "karma-coffee-preprocessor": "~1.0.1", + "karma-coverage": "~1.1.1", + "karma-firefox-launcher": "~1.0.0", + "karma-html2js-preprocessor": "~1.1.0", + "karma-jasmine": "~1.1.0", + "karma-phantomjs-launcher": "~1.0.2", + "karma-requirejs": "~1.1.0", + "karma-script-launcher": "~1.0.0", + "phantomjs-prebuilt": "~2.1.7", "grunt-ngdocs": "~0.2.1" } } diff --git a/test/unit/directives/gmMapSpec.js b/test/unit/directives/gmMapSpec.js index b0af351..d18166c 100644 --- a/test/unit/directives/gmMapSpec.js +++ b/test/unit/directives/gmMapSpec.js @@ -45,7 +45,7 @@ describe('gmMap', function() { // get MapController mapCtrl = elm.controller('gmMap'); - spyOn(mapCtrl, 'mapTrigger').andCallThrough(); + spyOn(mapCtrl, 'mapTrigger').and.callThrough(); var center, zoom, bounds; Object.defineProperties(mapCtrl, { @@ -238,29 +238,18 @@ describe('gmMap', function() { expect(mapCtrl.mapTrigger).not.toHaveBeenCalled(); }); - it('fires idle event when map loaded', inject(function($compile, $timeout) { + it('fires idle event when map loaded', function(done) { // this test is slow because we have to wait for google maps to load--eckh - var called = false; - - runs(function() { + var t = inject(function($compile) { elm = angular.element(''); var newScope = scope.$new(); newScope.mapId = scope.mapId + 'diff'; newScope.$on('gmMapIdle', function(event, mapId) { if (mapId === newScope.mapId) { - called = true; + done(); } }); $compile(elm)(newScope); }); - - waitsFor(function() { - return called; - }, 'Should fire idle event', 750); - - runs(function() { - expect(called).toBeTruthy(); - }); - })); - + }); }); diff --git a/test/unit/directives/gmMarkersSpec.js b/test/unit/directives/gmMarkersSpec.js index 9bafbed..f9d786d 100644 --- a/test/unit/directives/gmMarkersSpec.js +++ b/test/unit/directives/gmMarkersSpec.js @@ -42,11 +42,11 @@ describe('gmMarkers', function() { $compile(elm)(scope); mapCtrl = elm.controller('gmMap'); - spyOn(mapCtrl, 'addElement').andCallThrough(); - spyOn(mapCtrl, 'updateElement').andCallThrough(); - spyOn(mapCtrl, 'removeElement').andCallThrough(); - spyOn(mapCtrl, 'trigger').andCallThrough(); - spyOn(mapCtrl, 'addListener').andCallThrough(); + spyOn(mapCtrl, 'addElement').and.callThrough(); + spyOn(mapCtrl, 'updateElement').and.callThrough(); + spyOn(mapCtrl, 'removeElement').and.callThrough(); + spyOn(mapCtrl, 'trigger').and.callThrough(); + spyOn(mapCtrl, 'addListener').and.callThrough(); markersScopeId = elm.find('gm-markers').isolateScope().$id; @@ -134,8 +134,8 @@ describe('gmMarkers', function() { scope.people.push({name: 'new' + i, id: (i+10), location: {lat: i, lng: i}}); } scope.$digest(); - expect(mapCtrl.removeElement.calls.length).toEqual(length); - expect(mapCtrl.addElement.calls.length).toEqual(length * 2); + expect(mapCtrl.removeElement.calls.count()).toEqual(length); + expect(mapCtrl.addElement.calls.count()).toEqual(length * 2); }); @@ -151,7 +151,7 @@ describe('gmMarkers', function() { var origLength = scope.people.length; scope.people.push({name: '0', id: 0, location: {lat: 2, lng: 3}}); scope.$digest(); - expect(mapCtrl.addElement.callCount).toEqual(origLength); + expect(mapCtrl.addElement.calls.count()).toEqual(origLength); }); @@ -170,7 +170,7 @@ describe('gmMarkers', function() { var origLength = scope.people.length; scope.people.push(null); scope.$digest(); - expect(mapCtrl.addElement.callCount).toEqual(origLength); + expect(mapCtrl.addElement.calls.count()).toEqual(origLength); }); }); @@ -195,8 +195,8 @@ describe('gmMarkers', function() { scope.$digest(); $timeout.flush(); - var marker = mapCtrl.trigger.mostRecentCall.args[0]; - var event = mapCtrl.trigger.mostRecentCall.args[1]; + var marker = mapCtrl.trigger.calls.mostRecent()['args'][0]; + var event = mapCtrl.trigger.calls.mostRecent()['args'][1]; expect(latLngToObj(marker.getPosition())).toEqual(position); expect(event).toEqual('click'); }); @@ -214,8 +214,8 @@ describe('gmMarkers', function() { }] scope.$digest(); $timeout.flush(); - var marker0 = mapCtrl.trigger.calls[0].args[0]; - var marker1 = mapCtrl.trigger.calls[1].args[0]; + var marker0 = mapCtrl.trigger.calls.argsFor(0)[0]; + var marker1 = mapCtrl.trigger.calls.argsFor(1)[0]; expect(latLngToObj(marker0.getPosition())).toEqual(position0); expect(latLngToObj(marker1.getPosition())).toEqual(position1); }); @@ -236,8 +236,8 @@ describe('gmMarkers', function() { ] scope.$digest(); $timeout.flush(); - var event0 = mapCtrl.trigger.calls[0].args[1]; - var event1 = mapCtrl.trigger.calls[1].args[1]; + var event0 = mapCtrl.trigger.calls.argsFor(0)[1]; + var event1 = mapCtrl.trigger.calls.argsFor(1)[1]; expect(event0).toEqual('event0'); expect(event1).toEqual('event1'); }); @@ -250,20 +250,19 @@ describe('gmMarkers', function() { }); - it('calls event handlers when event fired', function() { - var person = scope.people[0]; - var marker = mapCtrl.getElement('marker', markersScopeId, person.name); - var handled = false; - runs(function() { - google.maps.event.addListener(marker, 'mouseover', function() {handled = true;}); + describe('calls event handlers when event fired', function() { + beforeEach(function(done) { + var person = scope.people[0]; + var marker = mapCtrl.getElement('marker', markersScopeId, person.name); + google.maps.event.addListener(marker, 'mouseover', done); google.maps.event.trigger(marker, 'mouseover'); }); - waitsFor(function() { - return handled; - }, 'no mouseover', 500); - runs(function() { + + it('', function() { scope.$digest(); $timeout.flush(); + + var person = scope.people[0]; expect(scope.mouseovered.person).toEqual(person); }); }); diff --git a/test/unit/services/angulargmContainerSpec.js b/test/unit/services/angulargmContainerSpec.js index 52f6392..7ccd525 100644 --- a/test/unit/services/angulargmContainerSpec.js +++ b/test/unit/services/angulargmContainerSpec.js @@ -7,7 +7,7 @@ describe('angulargmContainer', function() { beforeEach(inject(function(angulargmContainer) { cntr = angulargmContainer; - mapSpy = spyOn(google.maps, 'Map').andCallFake(function() { + mapSpy = spyOn(google.maps, 'Map').and.callFake(function() { }); }));