Improve test in case of async call

This commit is contained in:
Edward Nash
2019-10-22 10:21:52 +02:00
parent a3c137cff1
commit ed18310136

View File

@@ -56,21 +56,23 @@ 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() {
it('is the Control when the Control uses the default target', function(done) {
const ctrl = new Control({element: document.createElement('div')});
ctrl.on('test-event', function(e) {
expect(e.target).to.be(ctrl);
done();
});
ctrl.dispatchEvent('test-event');
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({
element: document.createElement('div'),
target: document.createElement('div')
});
ctrl.on('test-event', function(e) {
expect(e.target).to.be(ctrl);
done();
});
ctrl.dispatchEvent('test-event');
ctrl.dispose();