mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-13 05:31:37 +08:00
Fixed tests
This commit is contained in:
@@ -18,4 +18,8 @@ const DOMHelper = windowObjects.reduce((result, obj) => {
|
||||
};
|
||||
}, {});
|
||||
|
||||
DOMHelper.setObject = (key, value) => {
|
||||
DOMHelper[key] = value;
|
||||
};
|
||||
|
||||
export default DOMHelper;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {createConfigFromSource} from '../../src/input/config_factory';
|
||||
import DOMHelper from '../../src/common/dom_helper';
|
||||
|
||||
function MyFileList(file) {
|
||||
Array.call(this);
|
||||
@@ -7,7 +8,7 @@ function MyFileList(file) {
|
||||
MyFileList.prototype = Object.create(Array.prototype);
|
||||
MyFileList.prototype.constructor = MyFileList;
|
||||
|
||||
const OriginalFileList = window.FileList;
|
||||
const OriginalFileList = DOMHelper.FileList;
|
||||
|
||||
function expectImageConfig(config) {
|
||||
expect(config.inputStream.type).to.equal("ImageStream");
|
||||
@@ -30,11 +31,11 @@ function expectLiveConfig(config) {
|
||||
|
||||
describe("createConfigFromSource", () => {
|
||||
beforeEach(function() {
|
||||
window.FileList = MyFileList;
|
||||
DOMHelper.setObject('FileList', MyFileList);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
window.FileList = OriginalFileList;
|
||||
DOMHelper.setObject('FileList', OriginalFileList);
|
||||
});
|
||||
|
||||
it("should create an image config for an image-file", () => {
|
||||
|
||||
Reference in New Issue
Block a user