11import React from 'react' ;
2- import TestUtils from 'react/lib/ReactTestUtils' ;
2+ import ReactDOM from 'react-dom' ;
3+ import TestUtils from 'react-addons-test-utils' ;
34import LinkedStateMixin from 'react/lib/LinkedStateMixin' ;
45import MaskedField from '../src/MaskedField' ;
56import * as EventUtils from './EventUtils' ;
@@ -20,8 +21,8 @@ describe('MaskedField', function() {
2021 // - undo?
2122
2223 function getFieldValue ( ) {
23- const inputComponent = TestUtils . findRenderedDOMComponentWithTag ( getField ( ) , 'input' ) ;
24- return React . findDOMNode ( inputComponent ) . value ;
24+ const input = TestUtils . findRenderedDOMComponentWithTag ( getField ( ) , 'input' ) ;
25+ return input . value ;
2526 }
2627
2728 function cursorPosShouldEql ( pos ) {
@@ -819,7 +820,7 @@ describe('MaskedField', function() {
819820 } ) ;
820821
821822 afterEach ( function ( ) {
822- React . unmountComponentAtNode ( container ) ;
823+ ReactDOM . unmountComponentAtNode ( container ) ;
823824 } ) ;
824825
825826 context ( "when the component isn't controlled" , function ( ) {
@@ -832,8 +833,8 @@ describe('MaskedField', function() {
832833 if ( props . value && ! props . onChange ) {
833834 props . readOnly = true ;
834835 }
835- component = React . render ( < MaskedField { ...props } /> , container ) ;
836- domNode = React . findDOMNode ( component ) ;
836+ component = ReactDOM . render ( < MaskedField { ...props } /> , container ) ;
837+ domNode = ReactDOM . findDOMNode ( component ) ;
837838 } ) ;
838839
839840 afterEach ( function ( ) {
@@ -910,8 +911,8 @@ describe('MaskedField', function() {
910911 } ) ;
911912
912913 beforeEach ( function ( ) {
913- component = React . render ( < ControlledWrapper { ...props } /> , container ) ;
914- domNode = React . findDOMNode ( component ) ;
914+ component = ReactDOM . render ( < ControlledWrapper { ...props } /> , container ) ;
915+ domNode = ReactDOM . findDOMNode ( component ) ;
915916 } ) ;
916917
917918 setupTests ( function ( ) {
@@ -984,11 +985,11 @@ describe('MaskedField', function() {
984985 } ) ;
985986
986987 beforeEach ( function ( ) {
987- component = React . render (
988+ component = ReactDOM . render (
988989 < LinkWrapper mask = '99/99/9999' value = { value } /> ,
989990 container
990991 ) ;
991- domNode = React . findDOMNode ( component ) ;
992+ domNode = ReactDOM . findDOMNode ( component ) ;
992993 return simulateFocus ( ) ;
993994 } ) ;
994995
@@ -1032,12 +1033,14 @@ describe('MaskedField', function() {
10321033 } ) ;
10331034
10341035 context ( 'when the parent component contains multiple inputs' , function ( ) {
1036+ let inputNode ;
1037+ let fieldComponent ;
10351038 const Parent = React . createClass ( {
10361039 render ( ) {
10371040 return (
10381041 < div >
1039- < input onChange = { this . _onChange } ref = 'input' />
1040- < MaskedField mask = '99-99-9999' ref = 'field' />
1042+ < input onChange = { this . _onChange } ref = { c => ( inputNode = c ) } />
1043+ < MaskedField mask = '99-99-9999' ref = { c => ( fieldComponent = c ) } />
10411044 </ div >
10421045 ) ;
10431046 } ,
@@ -1047,21 +1050,21 @@ describe('MaskedField', function() {
10471050 } ) ;
10481051
10491052 beforeEach ( function ( ) {
1050- component = React . render (
1053+ component = ReactDOM . render (
10511054 < Parent /> ,
10521055 container
10531056 ) ;
1054- return EventUtils . simulateFocus ( React . findDOMNode ( component . refs . input ) ) ;
1057+ return EventUtils . simulateFocus ( inputNode ) ;
10551058 } ) ;
10561059
10571060 context ( 'when the masked field does not have focus' , function ( ) {
10581061 let fieldNode ;
10591062
10601063 describe ( 'typing into a sibling input' , function ( ) {
10611064 beforeEach ( function ( ) {
1062- fieldNode = React . findDOMNode ( component . refs . field ) ;
1065+ fieldNode = ReactDOM . findDOMNode ( fieldComponent ) ;
10631066 sinon . spy ( fieldNode , 'setSelectionRange' ) ;
1064- EventUtils . simulateChange ( React . findDOMNode ( component . refs . input ) , 'hello' ) ;
1067+ EventUtils . simulateChange ( inputNode , 'hello' ) ;
10651068 } ) ;
10661069
10671070 afterEach ( function ( ) {
0 commit comments