Improve test in case of async call
This commit is contained in:
@@ -56,21 +56,23 @@ describe('ol.control.Control\'s target', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('ol.control.Control\'s event target', function() {
|
describe('ol.control.Control\'s event target', function() {
|
||||||
it('is the Control when the Control uses the default target', function() {
|
it('is the Control when the Control uses the default target', function(done) {
|
||||||
const ctrl = new Control({element: document.createElement('div')});
|
const ctrl = new Control({element: document.createElement('div')});
|
||||||
ctrl.on('test-event', function(e) {
|
ctrl.on('test-event', function(e) {
|
||||||
expect(e.target).to.be(ctrl);
|
expect(e.target).to.be(ctrl);
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
ctrl.dispatchEvent('test-event');
|
ctrl.dispatchEvent('test-event');
|
||||||
ctrl.dispose();
|
ctrl.dispose();
|
||||||
});
|
});
|
||||||
it('is the Control when the Control has a custom target', function() {
|
it('is the Control when the Control has a custom target', function(done) {
|
||||||
const ctrl = new Control({
|
const ctrl = new Control({
|
||||||
element: document.createElement('div'),
|
element: document.createElement('div'),
|
||||||
target: document.createElement('div')
|
target: document.createElement('div')
|
||||||
});
|
});
|
||||||
ctrl.on('test-event', function(e) {
|
ctrl.on('test-event', function(e) {
|
||||||
expect(e.target).to.be(ctrl);
|
expect(e.target).to.be(ctrl);
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
ctrl.dispatchEvent('test-event');
|
ctrl.dispatchEvent('test-event');
|
||||||
ctrl.dispose();
|
ctrl.dispose();
|
||||||
|
|||||||
Reference in New Issue
Block a user