diff --git a/spec/Layers/FeatureLayer/FeatureLayerSpec.js b/spec/Layers/FeatureLayer/FeatureLayerSpec.js index 60886d7b2..f8f7f95e8 100644 --- a/spec/Layers/FeatureLayer/FeatureLayerSpec.js +++ b/spec/Layers/FeatureLayer/FeatureLayerSpec.js @@ -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' @@ -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')); diff --git a/src/Layers/FeatureLayer/FeatureLayer.js b/src/Layers/FeatureLayer/FeatureLayer.js index 33c7afbd8..39012bd9e 100644 --- a/src/Layers/FeatureLayer/FeatureLayer.js +++ b/src/Layers/FeatureLayer/FeatureLayer.js @@ -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); }