Skip to content

Commit

Permalink
Tests pass
Browse files Browse the repository at this point in the history
Rewrite map mock, so test successfully pass
  • Loading branch information
goooseman committed Sep 14, 2015
1 parent e20d5d0 commit 591e4ad
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions spec/ymaps.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,18 @@ describe('Ymaps', function() {
$provide.value('debounce', angular.identity);
$provide.factory('ymapsLoader', function($q) {
mapMock = {
options: jasmine.createSpyObj('mapOptions', ['get', 'set']),
events: jasmine.createSpyObj('mapEvents', ['add']),
panTo: jasmine.createSpy('panSpy').and.callFake(function() {
this.deferred = $q.defer();
this.deferred.promise.always = this.deferred.promise.finally;
return this.deferred.promise;
}),
setBounds: jasmine.createSpy('mapBounds'),
setBounds: jasmine.createSpy('mapBounds').and.callFake(function() {
this.deferred = $q.defer();
this.deferred.promise.always = this.deferred.promise.finally;
return this.deferred.promise;
}),
setZoom: jasmine.createSpy('zoomSpy'),
controls: jasmine.createSpyObj('mapObjControls', ['add']),
geoObjects: jasmine.createSpyObj('mapObjElements', ['add'])
Expand All @@ -69,7 +74,7 @@ describe('Ymaps', function() {
GeoObjectCollection: jasmine.createSpy('geoObjectsCollection').and.returnValue(geoObjectsMock),
Placemark: jasmine.createSpy('placemark').and.returnValue(placemarkMock)
};
return {
return {
ready: function(callback) {callback(ymapsMock);}
};
});
Expand Down Expand Up @@ -146,7 +151,7 @@ describe('Ymaps', function() {
scope.$apply();
callback(new YaEvent({newCenter: [62.16, 34.56], newZoom: 23}));
expect(scope.center).toEqual([62.16, 34.56]);
});
});

it('should add nested markers to map', function() {
createElement(
Expand Down

0 comments on commit 591e4ad

Please sign in to comment.