Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes to make compatible with jsdom 2.0.0-4.0.1 #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ executing `npm run jsx`. This will save the built file into

### jsdom

Setting up jsdom ^2.0.0 can be acheived in a couple of lines:
Setting up jsdom 2.0.0-4.0.1 can be acheived in a couple of lines:

```javascript
// file: test/setup.js
Expand All @@ -95,9 +95,12 @@ var jsdom = require('jsdom');
// A super simple DOM ready for React to render into
// Store this DOM and the window in global scope ready for React to access
global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
global.window = document.parentWindow;
global.window = document.defaultView;
global.navigator = window.navigator;
```



We are emulating a browser environment here by setting the global variables
`document` and `window` as created by `jsdom`. This later allows React to render
into the `document`, and utilize functions existing on `window` such as
Expand Down Expand Up @@ -250,7 +253,7 @@ $ npm test


Todo-item component
✓ <input> should be of type "checkbox"
✓ <input> should be of type "checkbox"


1 passing (25ms)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"author": "Jess Telford <[email protected]>",
"license": "ISC",
"devDependencies": {
"jsdom": "^2.0.0",
"jsdom": "^3.1.2",
"mocha": "^2.1.0",
"react-tools": "^0.12.1"
},
Expand Down
3 changes: 2 additions & 1 deletion test/setup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var jsdom = require('jsdom');

global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
global.window = document.parentWindow;
global.window = document.defaultView;
global.navigator = window.navigator;