Skip to content

Commit

Permalink
add test for issue633
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Guilhaudin committed Jan 3, 2018
1 parent f40529d commit 78d6927
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec/Layers/DynamicMapLayerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,34 @@ describe('L.esri.DynamicMapLayer', function () {
expect(spy).to.have.been.calledWith('dblclick', layer._resetPopupState, layer);
});

it('should use custom identify behavior if specified in popup options', function () {
server.respondWith('GET', new RegExp(/http:\/\/services.arcgis.com\/mock\/arcgis\/rest\/services\/MockMapService\/MapServer\/identify\?sr=4326&layers=all%3A0&tolerance=5&returnGeometry=false&layerDefs=0%3Afoo%3D%22bar%22&imageDisplay=500%2C500%2C96&mapExtent=-?\d+\.\d+%2C-?\d+\.\d+%2C-?\d+\.\d+%2C-?\d+\.\d+&geometry=%7B%22x%22%3A-?\d+\.\d+%2C%22y%22%3A-?\d+\.\d+%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D+&geometryType=esriGeometryPoint&maxAllowableOffset=0.000171661376953125&f=json/), JSON.stringify(sampleResponse));

layer.bindPopup(function (error, featureCollection) {
return featureCollection.features.length + ' Feature(s)';
});

var customIdentify = L.esri.identifyFeatures({ url: url })
.layers('all:0')
.layerDef(0, 'foo="bar"')
.tolerance(5)
.returnGeometry(false);

layer.options.popup = customIdentify;
layer.addTo(map);

map.fire('click', {
latlng: map.getCenter()
});

server.respond();

clock.tick(301);

expect(layer._popup.getContent()).to.equal('1 Feature(s)');
expect(layer._popup.getLatLng()).to.equal(map.getCenter());
});

it('should render an image at the back if specified', function (done) {
layer.bringToBack();
var spy = sinon.spy(layer, 'bringToBack');
Expand Down

0 comments on commit 78d6927

Please sign in to comment.