From b231329bb9f1402e5971f9134cdc27242cbb3ea7 Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Thu, 9 May 2019 13:45:37 +0200 Subject: Mock away document.createRange() (cherry picked from commit a0e7e2075c6182838a0645e0bbb3927e5f9a8bba) --- spec/frontend/environment.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec/frontend') diff --git a/spec/frontend/environment.js b/spec/frontend/environment.js index 9612162ad0c..a8c8688441d 100644 --- a/spec/frontend/environment.js +++ b/spec/frontend/environment.js @@ -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() { -- cgit v1.2.1