Add regression test for event target on Control
* Check possible name collision of target element with EventTarget
This commit is contained in:
@@ -54,3 +54,25 @@ describe('ol.control.Control\'s target', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('ol.control.Control\'s event target', function() {
|
||||||
|
it('is the Control when the Control uses the default target', function() {
|
||||||
|
const ctrl = new Control({element: document.createElement('div')});
|
||||||
|
ctrl.on('test-event', function(e) {
|
||||||
|
expect(e.target).to.be(ctrl);
|
||||||
|
});
|
||||||
|
ctrl.dispatchEvent('test-event');
|
||||||
|
ctrl.dispose();
|
||||||
|
});
|
||||||
|
it('is the Control when the Control has a custom target', function() {
|
||||||
|
const ctrl = new Control({
|
||||||
|
element: document.createElement('div'),
|
||||||
|
target: document.createElement('div')
|
||||||
|
});
|
||||||
|
ctrl.on('test-event', function(e) {
|
||||||
|
expect(e.target).to.be(ctrl);
|
||||||
|
});
|
||||||
|
ctrl.dispatchEvent('test-event');
|
||||||
|
ctrl.dispose();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user