Use class keyword in tests

This commit is contained in:
ahocevar
2018-07-18 16:30:09 +02:00
parent 9ed3540edf
commit 0a126b620c
3 changed files with 50 additions and 48 deletions

View File

@@ -1,4 +1,3 @@
import {inherits} from '../../../../src/ol/index.js';
import View from '../../../../src/ol/View.js';
import Event from '../../../../src/ol/events/Event.js';
import EventTarget from '../../../../src/ol/events/EventTarget.js';
@@ -94,14 +93,16 @@ where('FileReader').describe('ol.interaction.DragAndDrop', function() {
beforeEach(function() {
OrigFileReader = FileReader;
FileReader = function() {
EventTarget.apply(this, arguments);
this.readAsText = function(file) {
class MockFileReader extends EventTarget {
constructor() {
super(...arguments);
}
readAsText(file) {
this.result = file;
this.dispatchEvent('load');
};
};
inherits(FileReader, EventTarget);
}
}
FileReader = MockFileReader;
});
afterEach(function() {