Files
hanzi-writer/jest-jsdom-env.js
David Chanin 9b332248d3 fix: escaping the URL passed to clip-path to handle parentheses (#217)
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!
2021-02-01 20:39:20 +00:00

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();
}
};