Merge pull request #10160 from ejn/minor/improve-test-10158

Improve test in case of async call
This commit is contained in:
Tim Schaub
2019-10-22 07:06:36 -06:00
committed by GitHub

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();