This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic tests for the layersHerald
- Loading branch information
1 parent
cac8ad8
commit bbcf546
Showing
1 changed file
with
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
goog.provide('olgm.test.herald.Layers'); | ||
|
||
describe('olgm.herald.Layers', function() { | ||
// Setup constructor variables | ||
var originalOl3map = new ol.Map({}); | ||
var gmapEl = document.createElement('div'); | ||
gmapEl.style.height = '100px'; | ||
gmapEl.style.width = '100px'; | ||
var originalGmap = new google.maps.Map(gmapEl); | ||
var watchVector = true; | ||
|
||
describe('constructor', function() { | ||
var layersHerald = new olgm.herald.Layers( | ||
originalOl3map, originalGmap, watchVector); | ||
|
||
it('sets the Google Maps map', function() { | ||
var gmap = layersHerald.gmap; | ||
expect(gmap).to.be.an.instanceof(google.maps.Map); | ||
expect(gmap).to.equal(originalGmap); | ||
}); | ||
|
||
it('sets the OpenLayers map', function() { | ||
var ol3map = layersHerald.ol3map; | ||
expect(ol3map).to.be.an.instanceof(ol.Map); | ||
expect(ol3map).to.equal(originalOl3map); | ||
}); | ||
}); | ||
|
||
describe('#activate()', function() { | ||
it('adds listener keys for layers added and removed', function() { | ||
var layersHerald = new olgm.herald.Layers( | ||
originalOl3map, originalGmap, watchVector); | ||
var listenerKeys = layersHerald.listenerKeys; | ||
var expectedNbListenerKeys = listenerKeys.length + 2; | ||
|
||
layersHerald.activate(); | ||
|
||
expect(listenerKeys.length).to.equal(expectedNbListenerKeys); | ||
}); | ||
}); | ||
}); |