forked from tajo/react-portal
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This allows to write static properties in a nicer way. Also I've updated tests setup in order to have window object specified from the very beginning. Without this components were not able to use `window` before they were imported in tests.
- Loading branch information
1 parent
2a924c0
commit ffe9b4d
Showing
6 changed files
with
38 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
import setup from './setup'; | ||
|
||
process.env.NODE_ENV = 'test'; | ||
// Calling setup befere any components are imported in specs | ||
// Otherwise window object can not be used in static methods | ||
setup(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import jsdom from 'jsdom'; | ||
|
||
export default function setup() { | ||
global.document = jsdom.jsdom('<!doctype html><html><body></body></html>'); | ||
global.window = document.defaultView; | ||
global.navigator = { userAgent: 'node.js' }; | ||
} |