-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetupTests.js
More file actions
27 lines (23 loc) · 794 Bytes
/
setupTests.js
File metadata and controls
27 lines (23 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* Jest runner has been replaced from jsdom to jest-electron-runner
* https://github.com/facebook-atom/jest-electron-runner so there is no need for
* polyfill of web-components apis this file makes no sense and just be kept for
* reference
*/
global.Range = function Range() {}
/**
* There is a wrong implementation in
* https://stackoverflow.com/questions/42213522/mocking-document-createrange-for-j
* st watch out ❗
*
* @param {string} html
* @returns {DocumentFragment}
*/
const createContextualFragment = (html) => {
const template = document.createElement('template')
template.innerHTML = html
return template.content
}
Range.prototype.createContextualFragment = (html) =>
createContextualFragment(html)
// require('electron').remote.getCurrentWindow().show()