Named exports from ol/events
This commit is contained in:
@@ -3,7 +3,7 @@ import Map from '../../../../src/ol/Map.js';
|
||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import View from '../../../../src/ol/View.js';
|
||||
import {equals} from '../../../../src/ol/array.js';
|
||||
import _ol_events_ from '../../../../src/ol/events.js';
|
||||
import {listen} from '../../../../src/ol/events.js';
|
||||
import _ol_events_condition_ from '../../../../src/ol/events/condition.js';
|
||||
import Circle from '../../../../src/ol/geom/Circle.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
@@ -205,8 +205,8 @@ describe('ol.interaction.Draw', function() {
|
||||
it('triggers draw events', function() {
|
||||
const ds = sinon.spy();
|
||||
const de = sinon.spy();
|
||||
_ol_events_.listen(draw, 'drawstart', ds);
|
||||
_ol_events_.listen(draw, 'drawend', de);
|
||||
listen(draw, 'drawstart', ds);
|
||||
listen(draw, 'drawend', de);
|
||||
simulateEvent('pointermove', 10, 20);
|
||||
simulateEvent('pointerdown', 10, 20);
|
||||
simulateEvent('pointerup', 10, 20);
|
||||
@@ -222,7 +222,7 @@ describe('ol.interaction.Draw', function() {
|
||||
end: 0,
|
||||
addfeature: 0
|
||||
};
|
||||
_ol_events_.listen(draw, 'drawend',
|
||||
listen(draw, 'drawend',
|
||||
function() {
|
||||
expect(receivedEvents.end).to.be(0);
|
||||
expect(receivedEvents.addfeature).to.be(0);
|
||||
@@ -439,8 +439,8 @@ describe('ol.interaction.Draw', function() {
|
||||
it('triggers draw events', function() {
|
||||
const ds = sinon.spy();
|
||||
const de = sinon.spy();
|
||||
_ol_events_.listen(draw, 'drawstart', ds);
|
||||
_ol_events_.listen(draw, 'drawend', de);
|
||||
listen(draw, 'drawstart', ds);
|
||||
listen(draw, 'drawend', de);
|
||||
|
||||
// first point
|
||||
simulateEvent('pointermove', 10, 20);
|
||||
@@ -703,8 +703,8 @@ describe('ol.interaction.Draw', function() {
|
||||
it('triggers draw events', function() {
|
||||
const ds = sinon.spy();
|
||||
const de = sinon.spy();
|
||||
_ol_events_.listen(draw, 'drawstart', ds);
|
||||
_ol_events_.listen(draw, 'drawend', de);
|
||||
listen(draw, 'drawstart', ds);
|
||||
listen(draw, 'drawend', de);
|
||||
|
||||
// first point
|
||||
simulateEvent('pointermove', 10, 20);
|
||||
@@ -861,8 +861,8 @@ describe('ol.interaction.Draw', function() {
|
||||
it('triggers draw events', function() {
|
||||
const ds = sinon.spy();
|
||||
const de = sinon.spy();
|
||||
_ol_events_.listen(draw, 'drawstart', ds);
|
||||
_ol_events_.listen(draw, 'drawend', de);
|
||||
listen(draw, 'drawstart', ds);
|
||||
listen(draw, 'drawend', de);
|
||||
|
||||
// first point
|
||||
simulateEvent('pointermove', 10, 20);
|
||||
@@ -1088,7 +1088,7 @@ describe('ol.interaction.Draw', function() {
|
||||
|
||||
it('dispatches a drawstart event', function() {
|
||||
const spy = sinon.spy();
|
||||
_ol_events_.listen(draw, 'drawstart', spy);
|
||||
listen(draw, 'drawstart', spy);
|
||||
draw.extend(feature);
|
||||
expect(spy.callCount).to.be(1);
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import Feature from '../../../../src/ol/Feature.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import View from '../../../../src/ol/View.js';
|
||||
import _ol_events_ from '../../../../src/ol/events.js';
|
||||
import {getListeners} from '../../../../src/ol/events.js';
|
||||
import _ol_events_condition_ from '../../../../src/ol/events/condition.js';
|
||||
import Circle from '../../../../src/ol/geom/Circle.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
@@ -604,11 +604,11 @@ describe('ol.interaction.Modify', function() {
|
||||
});
|
||||
|
||||
describe('handle feature change', function() {
|
||||
let getListeners;
|
||||
let getModifyListeners;
|
||||
|
||||
beforeEach(function() {
|
||||
getListeners = function(feature, modify) {
|
||||
const listeners = _ol_events_.getListeners(
|
||||
getModifyListeners = function(feature, modify) {
|
||||
const listeners = getListeners(
|
||||
feature, 'change');
|
||||
return listeners.filter(function(listener) {
|
||||
return listener.bindTo === modify;
|
||||
@@ -628,7 +628,7 @@ describe('ol.interaction.Modify', function() {
|
||||
|
||||
let listeners;
|
||||
|
||||
listeners = getListeners(feature, modify);
|
||||
listeners = getModifyListeners(feature, modify);
|
||||
expect(listeners).to.have.length(1);
|
||||
|
||||
let firstSegmentData;
|
||||
@@ -652,7 +652,7 @@ describe('ol.interaction.Modify', function() {
|
||||
expect(firstSegmentData.segment[0]).to.eql([1, 1]);
|
||||
expect(firstSegmentData.segment[1]).to.eql([1, 1]);
|
||||
|
||||
listeners = getListeners(feature, modify);
|
||||
listeners = getModifyListeners(feature, modify);
|
||||
expect(listeners).to.have.length(1);
|
||||
});
|
||||
|
||||
@@ -665,7 +665,7 @@ describe('ol.interaction.Modify', function() {
|
||||
const feature = features[0];
|
||||
let listeners;
|
||||
|
||||
listeners = getListeners(feature, modify);
|
||||
listeners = getModifyListeners(feature, modify);
|
||||
expect(listeners).to.have.length(1);
|
||||
|
||||
let firstSegmentData;
|
||||
@@ -690,7 +690,7 @@ describe('ol.interaction.Modify', function() {
|
||||
expect(firstSegmentData.segment[0]).to.eql([1, 1]);
|
||||
expect(firstSegmentData.segment[1]).to.eql([10, 20]);
|
||||
|
||||
listeners = getListeners(feature, modify);
|
||||
listeners = getModifyListeners(feature, modify);
|
||||
expect(listeners).to.have.length(1);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user