mirror of
https://github.com/chanind/hanzi-writer.git
synced 2026-03-13 09:44:39 +08:00
Fixing a bug where if the current page has parentheses in the URL, it would cause hanzi-writer to break. Thanks @ cqiangcode for finding this!
21 lines
440 B
JavaScript
21 lines
440 B
JavaScript
/**
|
|
* Hack to allow us to modify jsdom from within tests
|
|
* from https://github.com/facebook/jest/issues/5124#issuecomment-352749005
|
|
* */
|
|
|
|
const JSDOMEnvironment = require('jest-environment-jsdom');
|
|
|
|
module.exports = class JSDOMEnvironmentGlobal extends JSDOMEnvironment {
|
|
constructor(config) {
|
|
super(config);
|
|
|
|
this.global.jsdom = this.dom;
|
|
}
|
|
|
|
teardown() {
|
|
this.global.jsdom = null;
|
|
|
|
return super.teardown();
|
|
}
|
|
};
|