Skip to content

Commit fe6a312

Browse files
committed
refactor imports
1 parent ff922fe commit fe6a312

12 files changed

+77
-77
lines changed

modules/__tests__/History-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*eslint-env mocha */
22
import expect from 'expect'
33
import React from 'react'
4-
import ReactDOM from 'react-dom'
4+
import { render, unmountComponentAtNode } from 'react-dom'
55
import History from '../History'
66
import Router from '../Router'
77
import Route from '../Route'
@@ -15,7 +15,7 @@ describe('History Mixin', function () {
1515
})
1616

1717
afterEach(function () {
18-
ReactDOM.unmountComponentAtNode(node)
18+
unmountComponentAtNode(node)
1919
})
2020

2121
it('assigns the history to the component instance', function (done) {
@@ -31,7 +31,7 @@ describe('History Mixin', function () {
3131
render() { return null }
3232
})
3333

34-
ReactDOM.render((
34+
render((
3535
<Router history={history}>
3636
<Route path="/" component={Component} />
3737
</Router>

modules/__tests__/IndexLink-test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*eslint react/prop-types: 0*/
33
import expect from 'expect'
44
import React from 'react'
5-
import ReactDOM from 'react-dom'
5+
import { render, unmountComponentAtNode } from 'react-dom'
66
import createHistory from 'history/lib/createMemoryHistory'
77
import IndexRoute from '../IndexRoute'
88
import IndexLink from '../IndexLink'
@@ -83,12 +83,12 @@ describe('An <IndexLink>', function () {
8383
})
8484

8585
afterEach(function () {
86-
ReactDOM.unmountComponentAtNode(node)
86+
unmountComponentAtNode(node)
8787
})
8888

8989
describe('when linking to the overview', function () {
9090
it('is active and other routes are not', function (done) {
91-
ReactDOM.render((
91+
render((
9292
<Router history={createHistory('/website')} routes={routes} />
9393
), node, function () {
9494
expect(node.querySelector('#overviewLink').className).toEqual('active')
@@ -102,7 +102,7 @@ describe('An <IndexLink>', function () {
102102

103103
describe('when linking to the contact', function () {
104104
it('is active and other routes are not', function (done) {
105-
ReactDOM.render((
105+
render((
106106
<Router history={createHistory('/website/contact')} routes={routes} />
107107
), node, function () {
108108
expect(node.querySelector('#overviewLink').className).toEqual('')
@@ -116,7 +116,7 @@ describe('An <IndexLink>', function () {
116116

117117
describe('when linking to the products', function () {
118118
it('is active and other routes are not', function (done) {
119-
ReactDOM.render((
119+
render((
120120
<Router history={createHistory('/website/products')} routes={routes} />
121121
), node, function () {
122122
expect(node.querySelector('#overviewLink').className).toEqual('')
@@ -130,7 +130,7 @@ describe('An <IndexLink>', function () {
130130

131131
describe('when linking to a specific product', function () {
132132
it("is active and it's parent is also active", function (done) {
133-
ReactDOM.render((
133+
render((
134134
<Router history={createHistory('/website/products/15')} routes={routes} />
135135
), node, function () {
136136
expect(node.querySelector('#overviewLink').className).toEqual('')

modules/__tests__/IndexRedirect-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*eslint-env mocha */
22
import expect from 'expect'
33
import React from 'react'
4-
import ReactDOM from 'react-dom'
4+
import { render, unmountComponentAtNode } from 'react-dom'
55
import createHistory from 'history/lib/createMemoryHistory'
66
import IndexRedirect from '../IndexRedirect'
77
import Router from '../Router'
@@ -15,11 +15,11 @@ describe('An <IndexRedirect>', function () {
1515
})
1616

1717
afterEach(function () {
18-
ReactDOM.unmountComponentAtNode(node)
18+
unmountComponentAtNode(node)
1919
})
2020

2121
it('works', function (done) {
22-
ReactDOM.render((
22+
render((
2323
<Router history={createHistory('/')}>
2424
<Route path="/">
2525
<IndexRedirect to="/messages" />

modules/__tests__/IndexRoute-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*eslint react/prop-types: 0*/
33
import expect from 'expect'
44
import React from 'react'
5-
import ReactDOM from 'react-dom'
5+
import { render, unmountComponentAtNode } from 'react-dom'
66
import createHistory from 'history/lib/createMemoryHistory'
77
import IndexRoute from '../IndexRoute'
88
import Router from '../Router'
@@ -28,11 +28,11 @@ describe('An <IndexRoute>', function () {
2828
})
2929

3030
afterEach(function () {
31-
ReactDOM.unmountComponentAtNode(node)
31+
unmountComponentAtNode(node)
3232
})
3333

3434
it('renders when its parent’s url matches exactly', function (done) {
35-
ReactDOM.render((
35+
render((
3636
<Router history={createHistory('/')}>
3737
<Route path="/" component={Parent}>
3838
<IndexRoute component={Child}/>
@@ -46,7 +46,7 @@ describe('An <IndexRoute>', function () {
4646

4747
describe('nested deeply in the route hierarchy', function () {
4848
it('renders when its parent’s url matches exactly', function (done) {
49-
ReactDOM.render((
49+
render((
5050
<Router history={createHistory('/test')}>
5151
<Route path="/" component={Parent}>
5252
<IndexRoute component={Child}/>

modules/__tests__/Link-test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import assert from 'assert'
44
import expect from 'expect'
55
import React from 'react'
66
import ReactTestUtils from 'react-addons-test-utils'
7-
import ReactDOM from 'react-dom'
7+
import { render } from 'react-dom'
88
import createHistory from 'history/lib/createMemoryHistory'
99
import execSteps from './execSteps'
1010
import Router from '../Router'
@@ -39,7 +39,7 @@ describe('A <Link>', function () {
3939
}
4040
}
4141

42-
ReactDOM.render((
42+
render((
4343
<Router history={createHistory('/')}>
4444
<Route path="/" component={LinkWrapper} />
4545
</Router>
@@ -81,7 +81,7 @@ describe('A <Link>', function () {
8181
}
8282

8383
it('is active when its params match', function (done) {
84-
ReactDOM.render((
84+
render((
8585
<Router history={createHistory('/hello/michael')}>
8686
<Route path="/" component={App}>
8787
<Route path="hello/:name" component={Hello} />
@@ -95,7 +95,7 @@ describe('A <Link>', function () {
9595
})
9696

9797
it('is not active when its params do not match', function (done) {
98-
ReactDOM.render((
98+
render((
9999
<Router history={createHistory('/hello/michael')}>
100100
<Route path="/" component={App}>
101101
<Route path="hello/:name" component={Hello} />
@@ -136,7 +136,7 @@ describe('A <Link>', function () {
136136

137137
const execNextStep = execSteps(steps, done)
138138

139-
ReactDOM.render((
139+
render((
140140
<Router history={createHistory('/goodbye')} onUpdate={execNextStep}>
141141
<Route path="/" component={LinkWrapper}>
142142
<Route path="goodbye" component={Goodbye} />
@@ -174,7 +174,7 @@ describe('A <Link>', function () {
174174

175175
const execNextStep = execSteps(steps, done)
176176

177-
ReactDOM.render((
177+
render((
178178
<Router history={createHistory('/goodbye')} onUpdate={execNextStep}>
179179
<Route path="/" component={LinkWrapper}>
180180
<Route path="goodbye" component={Goodbye} />
@@ -210,7 +210,7 @@ describe('A <Link>', function () {
210210

211211
const execNextStep = execSteps(steps, done)
212212

213-
ReactDOM.render((
213+
render((
214214
<Router history={createHistory('/goodbye')} onUpdate={execNextStep}>
215215
<Route path="/" component={LinkWrapper}>
216216
<Route path="hello" component={Hello} />
@@ -251,7 +251,7 @@ describe('A <Link>', function () {
251251

252252
const execNextStep = execSteps(steps, done)
253253

254-
ReactDOM.render((
254+
render((
255255
<Router history={createHistory('/goodbye')} onUpdate={execNextStep}>
256256
<Route path="/" component={LinkWrapper}>
257257
<Route path="goodbye" component={Goodbye} />
@@ -275,7 +275,7 @@ describe('A <Link>', function () {
275275
}
276276
}
277277

278-
ReactDOM.render((
278+
render((
279279
<Router history={createHistory('/')}>
280280
<Route path="/" component={LinkWrapper} />
281281
<Route path="/hello" component={Hello} />
@@ -306,7 +306,7 @@ describe('A <Link>', function () {
306306

307307
const execNextStep = execSteps(steps, done)
308308

309-
ReactDOM.render((
309+
render((
310310
<Router history={createHistory('/')} onUpdate={execNextStep}>
311311
<Route path="/" component={LinkWrapper} />
312312
<Route path="/hello" component={Hello} />

modules/__tests__/Redirect-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*eslint-env mocha */
22
import expect from 'expect'
33
import React from 'react'
4-
import ReactDOM from 'react-dom'
4+
import { render, unmountComponentAtNode } from 'react-dom'
55
import createHistory from 'history/lib/createMemoryHistory'
66
import Redirect from '../Redirect'
77
import Router from '../Router'
@@ -15,11 +15,11 @@ describe('A <Redirect>', function () {
1515
})
1616

1717
afterEach(function () {
18-
ReactDOM.unmountComponentAtNode(node)
18+
unmountComponentAtNode(node)
1919
})
2020

2121
it('works', function (done) {
22-
ReactDOM.render((
22+
render((
2323
<Router history={createHistory('/notes/5')}>
2424
<Route path="/messages/:id" />
2525
<Redirect from="/notes/:id" to="/messages/:id" />
@@ -31,7 +31,7 @@ describe('A <Redirect>', function () {
3131
})
3232

3333
it('works with relative paths', function (done) {
34-
ReactDOM.render((
34+
render((
3535
<Router history={createHistory('/nested/route1')}>
3636
<Route path="nested">
3737
<Route path="route2" />
@@ -45,7 +45,7 @@ describe('A <Redirect>', function () {
4545
})
4646

4747
it('works with relative paths with param', function (done) {
48-
ReactDOM.render((
48+
render((
4949
<Router history={createHistory('/nested/1/route1')}>
5050
<Route path="nested/:id">
5151
<Route path="route2" />

modules/__tests__/RouteComponent-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*eslint-env mocha */
22
import expect from 'expect'
33
import React from 'react'
4-
import ReactDOM from 'react-dom'
4+
import { render, unmountComponentAtNode } from 'react-dom'
55
import createHistory from 'history/lib/createMemoryHistory'
66
import Router from '../Router'
77

@@ -13,7 +13,7 @@ describe('a Route Component', function () {
1313
})
1414

1515
afterEach(function () {
16-
ReactDOM.unmountComponentAtNode(node)
16+
unmountComponentAtNode(node)
1717
})
1818

1919
it('injects the right props', function (done) {
@@ -40,7 +40,7 @@ describe('a Route Component', function () {
4040
expect(props.routes).toEqual([ parent, child ])
4141
}
4242

43-
ReactDOM.render((
43+
render((
4444
<Router history={createHistory('/child')} routes={parent}/>
4545
), node, done)
4646
})

0 commit comments

Comments
 (0)