Require that map layers are unique

This commit is contained in:
Tim Schaub
2017-04-11 21:30:20 -06:00
parent d28f50465b
commit 64b3302883
2 changed files with 23 additions and 2 deletions

View File

@@ -50,6 +50,27 @@ describe('ol.Map', function() {
});
describe('#addLayer()', function() {
it('adds a layer to the map', function() {
var map = new ol.Map({});
var layer = new ol.layer.Tile();
map.addLayer(layer);
expect(map.getLayers().item(0)).to.be(layer);
});
it('throws if a layer is added twice', function() {
var map = new ol.Map({});
var layer = new ol.layer.Tile();
map.addLayer(layer);
var call = function() {
map.addLayer(layer);
};
expect(call).to.throwException();
});
});
describe('#addInteraction()', function() {
it('adds an interaction to the map', function() {
var map = new ol.Map({});