Skip to content

Commit

Permalink
Merge pull request #19 from IntrepidPursuits/drf-switch-over-to-jest-…
Browse files Browse the repository at this point in the history
…and-react-15-latest

Switch over to jest and React 15.5.4
  • Loading branch information
davidrf authored May 20, 2017
2 parents 7aedd82 + 78baa67 commit ece04b0
Show file tree
Hide file tree
Showing 43 changed files with 1,824 additions and 1,528 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ as well if you are missing them.
```
$ npm install --save-dev enzyme
$ npm install --save-dev react-dom
$ npm install --save-dev react-addons-test-utils
$ npm install --save-dev react-test-renderer
```

If you are new to testing in React, check out the following guides to get you up and running:

* [Set up with Jest in Create React App](docs/faq/installation-jest.md)
* [Set up with Jest in Create React App (Recommended)](docs/faq/installation-jest.md)
* [Set up Karma with Mocha and Chai in Create React App](docs/faq/installation-karma-mocha-chai.md)
* [Set up Karma with Jasmine in Create React App](docs/faq/installation-karma-jasmine.md)

Expand Down
6 changes: 3 additions & 3 deletions docs/faq/installation-jest.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
1. Install [Create React App](https://github.com/facebookincubator/create-react-app)

```
$ npm install -g create-react-app@1.0.3
$ npm install -g create-react-app@1.3.1
```

2. Create a new React application
Expand All @@ -15,10 +15,10 @@
$ cd my-app
```

3. Install `react-page-object`, `enzyme`, and `react-addons-test-utils`
3. Install `react-page-object`, `enzyme`, and `react-test-renderer`

```
$ npm i -D react-page-object enzyme@2.7.0 react-addons-test-utils@15.4.1
$ npm i -D react-page-object enzyme@2.8.2 react-test-renderer@15.5.4
```

4. Modify the contents of `src/App.test.js` to be:
Expand Down
6 changes: 3 additions & 3 deletions docs/faq/installation-karma-jasmine.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
1. Install [Create React App](https://github.com/facebookincubator/create-react-app)

```
$ npm install -g create-react-app@1.0.3
$ npm install -g create-react-app@1.3.1
```

2. Create a new React application and eject from it
Expand All @@ -31,10 +31,10 @@
$ npm i -D [email protected] [email protected]
```

5. Install `react-page-object`, `enzyme`, and `react-addons-test-utils`
5. Install `react-page-object`, `enzyme`, and `react-test-renderer`

```
$ npm i -D react-page-object enzyme@2.7.0 react-addons-test-utils@15.4.1
$ npm i -D react-page-object enzyme@2.8.2 react-test-renderer@15.5.4
```

6. Modify your `package.json` `scripts` to be
Expand Down
6 changes: 3 additions & 3 deletions docs/faq/installation-karma-mocha-chai.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
1. Install [Create React App](https://github.com/facebookincubator/create-react-app)

```
$ npm install -g create-react-app@1.0.3
$ npm install -g create-react-app@1.3.1
```

2. Create a new React application and eject from it
Expand All @@ -31,10 +31,10 @@
$ npm i -D [email protected] [email protected] [email protected] [email protected]
```

5. Install `react-page-object`, `enzyme`, and `react-addons-test-utils`
5. Install `react-page-object`, `enzyme`, and `react-test-renderer`

```
$ npm i -D react-page-object enzyme@2.7.0 react-addons-test-utils@15.4.1
$ npm i -D react-page-object enzyme@2.8.2 react-test-renderer@15.5.4
```

6. Modify your `package.json` `scripts` to be
Expand Down
87 changes: 0 additions & 87 deletions karma.conf.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('blurFocusedElementSpec', () => {
let page
Expand All @@ -24,6 +24,7 @@ describe('blurFocusedElementSpec', () => {
window.spyOn(fakeWrapper, 'simulate')
page.blurFocusedElement()
expect(fakeWrapper.simulate).toHaveBeenCalledWith('blur')
expect(true).toBe(true)
})

it('should set focusedWrapper to null', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/checkSpec.js → lib/__tests__/checkSpec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('checkSpec', () => {
let onBlur, onChange, onFocus, page, secondOnChange
Expand Down
2 changes: 1 addition & 1 deletion test/chooseSpec.js → lib/__tests__/chooseSpec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('chooseSpec', () => {
let onBlur, onChange, onFocus, page, secondOnChange
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('clickButtonSpec', () => {
let onBlur, onClick, onFocus, page
Expand Down
2 changes: 1 addition & 1 deletion test/clickInputSpec.js → lib/__tests__/clickInputSpec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('clickInputSpec', () => {
let onBlur, onClick, onFocus, page
Expand Down
12 changes: 6 additions & 6 deletions test/clickLinkSpec.js → lib/__tests__/clickLinkSpec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import Page from 'react-page-object'
import { BrowserRouter, Link, Match } from 'react-router'
import Page from '../index'
import { BrowserRouter, Link, Route } from 'react-router-dom'

describe('clickLinkSpec', () => {
let onBlur, onFocus, page
Expand Down Expand Up @@ -30,10 +30,10 @@ describe('clickLinkSpec', () => {
const LinksReactRouter = ({ onBlur, onFocus }) => (
<BrowserRouter>
<div>
<Match exactly pattern="/" component={() => <Link id="propValueFirst" to="/second" onBlur={onBlur} onFocus={onFocus} />} />
<Match pattern="/second" component={() => <Link to="/third">propValueSecond</Link>} />
<Match pattern="/third" component={() => <Link to="/prop-value-third" />} />
<Match pattern="/prop-value-third" component={() => <Link className="propValueFourth" to="/" />} />
<Route exact pattern="/" component={() => <Link id="propValueFirst" to="/second" onBlur={onBlur} onFocus={onFocus} />} />
<Route pattern="/second" component={() => <Link to="/third">propValueSecond</Link>} />
<Route pattern="/third" component={() => <Link to="/prop-value-third" />} />
<Route pattern="/prop-value-third" component={() => <Link className="propValueFourth" to="/" />} />
</div>
</BrowserRouter>
)
Expand Down
6 changes: 3 additions & 3 deletions test/constructorSpec.js → lib/__tests__/constructorSpec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react'
import Page from 'react-page-object'
import { BrowserRouter, Match } from 'react-router'
import Page from '../index'
import { BrowserRouter, Link, Route } from 'react-router-dom'

describe('constructorSpec', () => {
let page
Expand Down Expand Up @@ -43,7 +43,7 @@ describe('constructorSpec', () => {
const TestComponentWithRouter = () => (
<BrowserRouter>
<div>
<Match exactly pattern="/" component={PageOne} />
<Route exact path="/" component={PageOne} />
</div>
</BrowserRouter>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('contentMatchesSpec', () => {
let page
Expand Down
2 changes: 1 addition & 1 deletion test/contentSpec.js → lib/__tests__/contentSpec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('contentSpec', () => {
let page
Expand Down
8 changes: 4 additions & 4 deletions test/currentPathSpec.js → lib/__tests__/currentPathSpec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import Page from 'react-page-object'
import { BrowserRouter, Link, Match } from 'react-router'
import Page from '../index'
import { BrowserRouter, Link, Route } from 'react-router-dom'

describe('currentPathSpec', () => {
let page
Expand All @@ -10,8 +10,8 @@ describe('currentPathSpec', () => {
<BrowserRouter>
<div>
<Link to="/two">Go To Page Two</Link>
<Match exactly pattern="/" component={PageOne} />
<Match pattern="/two" component={PageTwo} />
<Route exact path="/" component={PageOne} />
<Route path="/two" component={PageTwo} />
</div>
</BrowserRouter>
)
Expand Down
2 changes: 1 addition & 1 deletion test/destroySpec.js → lib/__tests__/destroySpec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('destroySpec', () => {
let page
Expand Down
2 changes: 1 addition & 1 deletion test/fillInSpec.js → lib/__tests__/fillInSpec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('fillInSpec', () => {
let onBlur, onChange, onFocus, page
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('fillInTextareaSpec', () => {
let onBlur, onChange, onFocus, page
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('findWrapperForCheckSpec', () => {
let page
Expand Down Expand Up @@ -43,7 +43,7 @@ describe('findWrapperForCheckSpec', () => {
it('should return ReactWrappers for inputs whose type prop value is \'checkbox\' and className prop matches the propValue', () => {
page = new Page(<InputsCustom />)
const wrapper = page.findWrapperForCheck('propValue', { propToCheck: 'className' })
expect(wrapper.html()).toEqual('<input type="checkbox" class="propValue" value="on">')
expect(wrapper.html()).toEqual('<input type="checkbox" class="propValue">')
})
})
})
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('findWrapperForChooseSpec', () => {
let page
Expand Down Expand Up @@ -43,7 +43,7 @@ describe('findWrapperForChooseSpec', () => {
it('should return ReactWrappers for inputs whose type prop value is \'radio\' and className prop matches the propValue', () => {
page = new Page(<InputsCustom />)
const wrapper = page.findWrapperForChoose('propValue', { propToCheck: 'className' })
expect(wrapper.html()).toEqual('<input type="radio" class="propValue" value="on">')
expect(wrapper.html()).toEqual('<input type="radio" class="propValue">')
})
})
})
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('findWrapperForClickButtonSpec', () => {
let page
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('findWrapperForClickInputSpec', () => {
let page
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('findWrapperForClickLinkSpec', () => {
let page
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('findWrapperForFillInSpec', () => {
let page
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('findWrapperForFillInTextareaSpec', () => {
let page
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('findWrapperForSelectSpec', () => {
let page
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('outputOpenPageCodeSpec', () => {
let page
Expand Down
2 changes: 1 addition & 1 deletion test/selectSpec.js → lib/__tests__/selectSpec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import Page from 'react-page-object'
import Page from '../index'

describe('selectSpec', () => {
let onBlur, onChange, onFocus, page
Expand Down
Loading

0 comments on commit ece04b0

Please sign in to comment.