Skip to content

Commit

Permalink
Added basic tests to editable:vertex:mouseover and editable:vertex:mo…
Browse files Browse the repository at this point in the history
…useout events
  • Loading branch information
Git-Lior authored and yohanboniface committed Jul 12, 2018
1 parent db8825d commit aaedf06
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/PolygonEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,31 @@ describe('L.PolygonEditor', function() {
layer.remove();
});

it('should fire editable:drawing:mouseover after hovering over vertex', function () {
var layer = L.polygon([p2ll(100, 150), p2ll(150, 200), p2ll(200, 100), p2ll(100, 100)]).addTo(this.map),
called = 0,
call = function () {called++;};
this.map.on('editable:vertex:mouseover', call);
layer.enableEdit();
assert.equal(called, 0);
happen.at("mouseover", 100, 150);
assert.ok(called);
this.map.off('editable:vertex:mouseover', call);
layer.remove();
});

it('should fire editable:drawing:mouseout after hovering out of a vertex', function () {
var layer = L.polygon([p2ll(100, 150), p2ll(150, 200), p2ll(200, 100), p2ll(100, 100)]).addTo(this.map),
called = 0,
call = function () {called++;};
this.map.on('editable:vertex:mouseout', call);
layer.enableEdit();
assert.equal(called, 0);
happen.at("mouseout", 100, 150);
assert.ok(called);
this.map.off('editable:vertex:mouseout', call);
layer.remove();
});
});

describe('Multi', function () {
Expand Down
26 changes: 26 additions & 0 deletions test/PolylineEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,32 @@ describe('L.PolylineEditor', function() {
layer.remove();
});

it('should fire editable:drawing:mouseover after hovering over vertex', function () {
var layer = L.polyline([p2ll(100, 100), p2ll(150, 150)]).addTo(this.map),
called = 0,
call = function () {called++;};
this.map.on('editable:vertex:mouseover', call);
layer.enableEdit();
assert.equal(called, 0);
happen.at("mouseover", 100, 100);
assert.ok(called);
this.map.off('editable:vertex:mouseover', call);
layer.remove();
});

it('should fire editable:drawing:mouseout after hovering out of a vertex', function () {
var layer = L.polyline([p2ll(100, 100), p2ll(150, 150)]).addTo(this.map),
called = 0,
call = function () {called++;};
this.map.on('editable:vertex:mouseout', call);
layer.enableEdit();
assert.equal(called, 0);
happen.at("mouseout", 100, 100);
assert.ok(called);
this.map.off('editable:vertex:mouseout', call);
layer.remove();
});

it('should send editable:drawing:click before adding vertex', function () {
var called = 0,
line,
Expand Down

0 comments on commit aaedf06

Please sign in to comment.