Files
openlayers/test/spec/ol/events/event.test.js
Tim Schaub ad62739a6e Use blocked scoped variables
In addition to using const and let, this also upgrades our linter config and removes lint (mostly whitespace).
2018-01-12 00:50:30 -07:00

49 lines
1.4 KiB
JavaScript

import Event from '../../../../src/ol/events/Event.js';
describe('ol.events.Event', function() {
describe('constructor', function() {
it('takes a type as argument', function() {
const event = new Event('foo');
expect(event.type).to.be('foo');
});
it('does not set the propagationStopped flag', function() {
const event = new Event('foo');
expect(event.propagationStopped).to.be(undefined);
});
});
describe('#preventDefault', function() {
it('sets the propagationStopped flag', function() {
const event = new Event('foo');
event.preventDefault();
expect(event.propagationStopped).to.be(true);
});
it('is the same as #stopPropagation', function() {
const event = new Event('foo');
expect(event.stopPropagation).to.equal(event.preventDefault);
});
});
describe('ol.events.Event.preventDefault', function() {
it('calls preventDefault on the event object', function() {
const event = {
preventDefault: sinon.spy()
};
Event.preventDefault(event);
expect(event.preventDefault.called).to.be(true);
});
});
describe('ol.events.Event.stopPropagation', function() {
it('calls preventDefault on the event object', function() {
const event = {
stopPropagation: sinon.spy()
};
Event.stopPropagation(event);
expect(event.stopPropagation.called).to.be(true);
});
});
});