Mock away document.createRange()

(cherry picked from commit a0e7e2075c)
This commit is contained in:
Winnie Hellmann 2019-05-09 13:45:37 +02:00
parent 9d4450263f
commit b231329bb9
1 changed files with 10 additions and 0 deletions

View File

@ -38,6 +38,16 @@ class CustomEnvironment extends JSDOMEnvironment {
this.global.fixturesBasePath = `${process.cwd()}/${
IS_EE ? 'ee/' : ''
}spec/javascripts/fixtures`;
// Not yet supported by JSDOM: https://github.com/jsdom/jsdom/issues/317
this.global.document.createRange = () => ({
setStart: () => {},
setEnd: () => {},
commonAncestorContainer: {
nodeName: 'BODY',
ownerDocument: this.global.document,
},
});
}
async teardown() {