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;
|
export default DOMHelper;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {createConfigFromSource} from '../../src/input/config_factory';
|
import {createConfigFromSource} from '../../src/input/config_factory';
|
||||||
|
import DOMHelper from '../../src/common/dom_helper';
|
||||||
|
|
||||||
function MyFileList(file) {
|
function MyFileList(file) {
|
||||||
Array.call(this);
|
Array.call(this);
|
||||||
@@ -7,7 +8,7 @@ function MyFileList(file) {
|
|||||||
MyFileList.prototype = Object.create(Array.prototype);
|
MyFileList.prototype = Object.create(Array.prototype);
|
||||||
MyFileList.prototype.constructor = MyFileList;
|
MyFileList.prototype.constructor = MyFileList;
|
||||||
|
|
||||||
const OriginalFileList = window.FileList;
|
const OriginalFileList = DOMHelper.FileList;
|
||||||
|
|
||||||
function expectImageConfig(config) {
|
function expectImageConfig(config) {
|
||||||
expect(config.inputStream.type).to.equal("ImageStream");
|
expect(config.inputStream.type).to.equal("ImageStream");
|
||||||
@@ -30,11 +31,11 @@ function expectLiveConfig(config) {
|
|||||||
|
|
||||||
describe("createConfigFromSource", () => {
|
describe("createConfigFromSource", () => {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
window.FileList = MyFileList;
|
DOMHelper.setObject('FileList', MyFileList);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function() {
|
afterEach(function() {
|
||||||
window.FileList = OriginalFileList;
|
DOMHelper.setObject('FileList', OriginalFileList);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should create an image config for an image-file", () => {
|
it("should create an image config for an image-file", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user