1
1
import React from 'react' ;
2
+ import ReactDOM from 'react-dom' ;
2
3
import ReactTestUtils from 'react/lib/ReactTestUtils' ;
3
4
import Modal from '../src/Modal' ;
4
5
import { render } from './helpers' ;
5
6
import jquery from 'jquery' ;
6
7
import simulant from 'simulant' ;
7
8
import Transition from '../src/Transition' ;
8
9
9
- let $ = componentOrNode => jquery ( React . findDOMNode ( componentOrNode ) ) ;
10
+ let $ = componentOrNode => jquery ( ReactDOM . findDOMNode ( componentOrNode ) ) ;
10
11
11
12
describe ( 'Modal' , function ( ) {
12
13
let mountPoint ;
@@ -17,7 +18,7 @@ describe('Modal', function () {
17
18
} ) ;
18
19
19
20
afterEach ( function ( ) {
20
- React . unmountComponentAtNode ( mountPoint ) ;
21
+ ReactDOM . unmountComponentAtNode ( mountPoint ) ;
21
22
document . body . removeChild ( mountPoint ) ;
22
23
} ) ;
23
24
@@ -28,8 +29,7 @@ describe('Modal', function () {
28
29
</ Modal >
29
30
, mountPoint ) ;
30
31
31
- assert . ok (
32
- ReactTestUtils . findRenderedDOMComponentWithTag ( instance . refs . modal , 'strong' ) ) ;
32
+ assert . equal ( instance . refs . modal . querySelectorAll ( 'strong' ) . length , 1 ) ;
33
33
} ) ;
34
34
35
35
it ( 'Should disable scrolling on the modal container while open' , function ( ) {
@@ -57,7 +57,7 @@ describe('Modal', function () {
57
57
58
58
let instance = render ( < Container /> , mountPoint ) ;
59
59
let modal = ReactTestUtils . findRenderedComponentWithType ( instance , Modal ) ;
60
- let backdrop = React . findDOMNode ( modal . refs . backdrop ) ;
60
+ let backdrop = modal . refs . backdrop ;
61
61
62
62
expect ( $ ( instance ) . css ( 'overflow' ) ) . to . equal ( 'hidden' ) ;
63
63
@@ -92,7 +92,7 @@ describe('Modal', function () {
92
92
93
93
let instance = render ( < Container /> , mountPoint ) ;
94
94
let modal = ReactTestUtils . findRenderedComponentWithType ( instance , Modal ) ;
95
- let backdrop = React . findDOMNode ( modal . refs . backdrop ) ;
95
+ let backdrop = modal . refs . backdrop ;
96
96
97
97
expect ( $ ( instance ) . hasClass ( 'test test2' ) ) . to . be . true ;
98
98
@@ -109,7 +109,7 @@ describe('Modal', function () {
109
109
</ Modal >
110
110
, mountPoint ) ;
111
111
112
- let backdrop = React . findDOMNode ( instance . refs . backdrop ) ;
112
+ let backdrop = instance . refs . backdrop ;
113
113
114
114
ReactTestUtils . Simulate . click ( backdrop ) ;
115
115
@@ -124,7 +124,7 @@ describe('Modal', function () {
124
124
</ Modal >
125
125
, mountPoint ) ;
126
126
127
- let backdrop = React . findDOMNode ( instance . refs . backdrop ) ;
127
+ let backdrop = instance . refs . backdrop ;
128
128
129
129
ReactTestUtils . Simulate . click ( backdrop ) ;
130
130
} ) ;
@@ -137,7 +137,7 @@ describe('Modal', function () {
137
137
</ Modal >
138
138
, mountPoint ) ;
139
139
140
- let backdrop = React . findDOMNode ( instance . refs . backdrop ) ;
140
+ let backdrop = instance . refs . backdrop ;
141
141
142
142
ReactTestUtils . Simulate . click ( backdrop ) ;
143
143
@@ -152,7 +152,7 @@ describe('Modal', function () {
152
152
</ Modal >
153
153
, mountPoint ) ;
154
154
155
- let backdrop = React . findDOMNode ( instance . refs . backdrop ) ;
155
+ let backdrop = instance . refs . backdrop ;
156
156
157
157
simulant . fire ( backdrop , 'keyup' , { keyCode : 27 } ) ;
158
158
} ) ;
@@ -166,7 +166,7 @@ describe('Modal', function () {
166
166
</ Modal >
167
167
, mountPoint ) ;
168
168
169
- let backdrop = React . findDOMNode ( instance . refs . backdrop ) ;
169
+ let backdrop = instance . refs . backdrop ;
170
170
171
171
expect (
172
172
backdrop . style . borderWidth ) . to . equal ( '3px' ) ;
@@ -273,7 +273,7 @@ describe('Modal', function () {
273
273
} ) ;
274
274
275
275
afterEach ( function ( ) {
276
- React . unmountComponentAtNode ( focusableContainer ) ;
276
+ ReactDOM . unmountComponentAtNode ( focusableContainer ) ;
277
277
document . body . removeChild ( focusableContainer ) ;
278
278
} ) ;
279
279
0 commit comments