koel/resources/assets/js/tests/helper.js

14 lines
268 B
JavaScript
Raw Normal View History

2016-11-26 03:25:35 +00:00
import { jsdom } from 'jsdom'
2016-06-25 10:15:57 +00:00
2016-11-26 03:25:35 +00:00
const doc = jsdom('<!doctype html><html><body></body></html>')
const win = doc.defaultView
2016-06-25 10:15:57 +00:00
2016-11-26 03:25:35 +00:00
global.document = doc
global.window = win
2016-06-25 10:15:57 +00:00
Object.keys(window).forEach((key) => {
2016-06-25 16:05:24 +00:00
if (!(key in global)) {
2016-11-26 03:25:35 +00:00
global[key] = window[key]
2016-06-25 16:05:24 +00:00
}
2016-11-26 03:25:35 +00:00
})