File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,14 @@ import React, { Component } from 'react'
22import PropTypes from 'prop-types'
33import TestUtils from 'react-dom/test-utils'
44import { ThemeProvider } from '../../src/index'
5+ import { jsdom } from 'jsdom'
56
7+ const documentDom = jsdom ( '<!doctype html><html><body></body></html>' )
68beforeEach ( ( ) => {
9+ global . document = documentDom
10+ global . window = document . defaultView
11+ global . navigator = global . window . navigator
12+
713 jest . spyOn ( console , 'error' )
814 global . console . error . mockImplementation ( ( ) => { } )
915} )
Original file line number Diff line number Diff line change 11import React , { Children , Component } from 'react'
22import PropTypes from 'prop-types'
3+ import { jsdom } from 'jsdom'
34import TestUtils from 'react-dom/test-utils'
45import sinon from 'sinon'
56import { render } from 'react-dom'
67import shallowEqual from 'fbjs/lib/shallowEqual'
78import { themr , themeable } from '../../src/index'
89
10+ const documentDom = jsdom ( '<!doctype html><html><body></body></html>' )
11+
912describe ( 'Themr decorator function' , ( ) => {
1013 class Passthrough extends Component {
1114 render ( ) {
@@ -36,6 +39,10 @@ describe('Themr decorator function', () => {
3639 }
3740
3841 beforeEach ( ( ) => {
42+ global . document = documentDom
43+ global . window = document . defaultView
44+ global . navigator = global . window . navigator
45+
3946 jest . spyOn ( console , 'error' )
4047 global . console . error . mockImplementation ( ( ) => { } )
4148 } )
You can’t perform that action at this time.
0 commit comments