Skip to content

Commit

Permalink
readd, not recreate
Browse files Browse the repository at this point in the history
  • Loading branch information
jgravois committed Jun 24, 2016
1 parent 157c62d commit 271f759
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
42 changes: 21 additions & 21 deletions spec/Layers/FeatureLayer/FeatureLayerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,27 +120,6 @@ describe('L.esri.FeatureLayer', function () {
layer.createLayers(features);
});

it('should fire a createfeature event when a layer is readded to the map', function(done){
layer = L.esri.featureLayer({
url: 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0',
timeField: 'time',
pointToLayer: function(feature, latlng){
return L.circleMarker(latlng);
}
}).addTo(map);

layer.createLayers(features);
map.removeLayer(layer);

layer.on('createfeature', function(e){
expect(e.feature.id).to.equal(2);
done();
});

map.addLayer(layer);
layer.createLayers(features);
});

it('should have an alias at L.esri.featureLayer', function(){
var layer = L.esri.featureLayer({
url: 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0'
Expand Down Expand Up @@ -200,6 +179,27 @@ describe('L.esri.FeatureLayer', function () {
layer.addLayers([1]);
});

it('should fire an addfeature event when a featureLayer is readded to the map', function(done){
layer = L.esri.featureLayer({
url: 'http://gis.example.com/mock/arcgis/rest/services/MockService/MockFeatureServer/0',
timeField: 'time',
pointToLayer: function(feature, latlng){
return L.circleMarker(latlng);
}
}).addTo(map);

layer.createLayers(features);
map.removeLayer(layer);

layer.on('addfeature', function(e){
expect(e.feature.id).to.equal(2);
done();
});

map.addLayer(layer);
layer.createLayers(features);
});

it('should not add features outside the time range', function(){
layer.setTimeRange(new Date('January 1 2014'), new Date('Febuary 1 2014'));

Expand Down
2 changes: 1 addition & 1 deletion src/Layers/FeatureLayer/FeatureLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export var FeatureLayer = FeatureManager.extend({

if (this._visibleZoom() && layer && !this._map.hasLayer(layer)) {
this._map.addLayer(layer);
this.fire('createfeature', {
this.fire('addfeature', {
feature: layer.feature
}, true);
}
Expand Down

0 comments on commit 271f759

Please sign in to comment.