Add workaround for innerText in Jest

This commit is contained in:
Winnie Hellmann 2019-03-28 20:42:32 +01:00
parent 7a7866a54a
commit 346f7027e2
1 changed files with 9 additions and 0 deletions

View File

@ -23,3 +23,12 @@ beforeEach(done => {
});
Vue.use(Translate);
// workaround for JSDOM not supporting innerText
// see https://github.com/jsdom/jsdom/issues/1245
Object.defineProperty(global.Element.prototype, 'innerText', {
get() {
return this.textContent;
},
configurable: true, // make it so that it doesn't blow chunks on re-running tests with things like --watch
});