diff --git a/test/spec/ol/interaction/drawinteraction.test.js b/test/spec/ol/interaction/drawinteraction.test.js index a75d150189..1925892958 100644 --- a/test/spec/ol/interaction/drawinteraction.test.js +++ b/test/spec/ol/interaction/drawinteraction.test.js @@ -338,8 +338,8 @@ describe('ol.interaction.Draw', function() { var draw = new ol.interaction.Draw({ source: source, type: ol.geom.GeometryType.LINE_STRING, - finishFunction: function(event) { - if (ol.array.equals(event.pixel,[30,20])) { + finishCondition: function(event) { + if (ol.array.equals(event.coordinate,[30,-20])) { return true; } return false; @@ -350,32 +350,33 @@ describe('ol.interaction.Draw', function() { it('draws a linestring failing to finish it first, the finishes it', function() { var features; + // first point simulateEvent('pointermove', 10, 20); simulateEvent('pointerdown', 10, 20); simulateEvent('pointerup', 10, 20); - // second point - simulateEvent('pointermove', 30, 20); - simulateEvent('pointerdown', 30, 20); - simulateEvent('pointerup', 30, 20); - - // cannot finish on this point - simulateEvent('pointerdown', 30, 20); - simulateEvent('pointerup', 30, 20); - - features = source.getFeatures(); - expect(features).to.have.length(1); - // second point simulateEvent('pointermove', 40, 30); simulateEvent('pointerdown', 40, 30); simulateEvent('pointerup', 40, 30); - // finish on this point + // try to finish on this point simulateEvent('pointerdown', 40, 30); simulateEvent('pointerup', 40, 30); + features = source.getFeatures(); + expect(features).to.have.length(0); + + // third point + simulateEvent('pointermove', 30, 20); + simulateEvent('pointerdown', 30, 20); + simulateEvent('pointerup', 30, 20); + + // finish on this point + simulateEvent('pointerdown', 30, 20); + simulateEvent('pointerup', 30, 20); + features = source.getFeatures(); expect(features).to.have.length(1); });