-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(marker.js): add check to scope teardown (#315)
On a $scope.$destroy the unregisterHandler function is called. This function removes all the eventListeners. The properties object that these listeners are attached to, might not exist. So during the teardown, an error will be raised. This fixes issue #314
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
/*jshint -W117 */ | ||
/*jshint globalstrict: true*/ | ||
/* jasmine specs for directives go here */ | ||
|
||
describe('Directive: openlayers marker', function() { | ||
var $compile = null; | ||
var scope; | ||
|
||
beforeEach(module('openlayers-directive')); | ||
beforeEach(inject(function(_$compile_, $rootScope) { | ||
$compile = _$compile_; | ||
|
||
scope = $rootScope.$new(); | ||
})); | ||
|
||
it('should not error on $scope.$destroy', function() { | ||
var element = angular.element('<openlayers><ol-marker lat="0" lon="0"></ol-marker></openlayers>'); | ||
element = $compile(element)(scope); | ||
scope.$digest(); | ||
expect(function() { scope.$destroy(); }).not.toThrow(); | ||
}); | ||
}); |