Skip to content

Commit

Permalink
Add failing test case for Leaflet#192
Browse files Browse the repository at this point in the history
  • Loading branch information
danmichaelo committed Sep 8, 2019
1 parent d766b9c commit 36d15b5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/PolylineEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,33 @@ describe('L.PolylineEditor', function() {
assert.notOk(layer.editEnabled());
});

it('should be draggable after re-enabling', function (done) {
var latlngs = [p2ll(100, 100), p2ll(100, 200)],
layer = L.polyline(latlngs).addTo(this.map),
before = layer._latlngs[1].lat;
layer.enableEdit();
layer.disableEdit();
layer.enableEdit();
happen.drag(100, 130, 120, 150, function () {
assert.notEqual(before, layer._latlngs[1].lat);
layer.remove();
done();
});
});

it('should be draggable after re-adding', function (done) {
var latlngs = [p2ll(100, 100), p2ll(100, 200)],
layer = L.polyline(latlngs).addTo(this.map),
before = layer._latlngs[1].lat;
layer.enableEdit();
this.map.removeLayer(layer);
this.map.addLayer(layer);
happen.drag(100, 130, 120, 150, function () {
assert.notEqual(before, layer._latlngs[1].lat);
layer.remove();
done();
});
});
});

describe('#enable()', function () {
Expand Down

0 comments on commit 36d15b5

Please sign in to comment.