@@ -14,24 +14,24 @@ import Radio from '../../src/react/radio';
1414import { getShallowRendererOutput } from '../lib/react-helpers' ;
1515
1616
17- describe ( 'react/radio' , function ( ) {
17+ describe ( 'react/radio' , function ( ) {
1818 let elem ;
1919
2020
21- beforeEach ( function ( ) {
21+ beforeEach ( function ( ) {
2222 elem = < Radio > My Label</ Radio > ;
2323 } ) ;
2424
2525
26- it ( 'renders wrapper properly' , function ( ) {
26+ it ( 'renders wrapper properly' , function ( ) {
2727 let result = getShallowRendererOutput ( elem ) ;
2828
2929 assert . equal ( result . type , 'div' ) ;
3030 assert . equal ( result . props . className , 'mui-radio ' ) ;
3131 } ) ;
3232
3333
34- it ( 'renders content properly' , function ( ) {
34+ it ( 'renders content properly' , function ( ) {
3535 let node = ReactUtils . renderIntoDocument ( elem ) ;
3636 let wrapperEl = ReactDOM . findDOMNode ( node ) ;
3737
@@ -45,7 +45,7 @@ describe('react/radio', function() {
4545 } ) ;
4646
4747
48- it ( 'renders properly with additional classNames' , function ( ) {
48+ it ( 'renders properly with additional classNames' , function ( ) {
4949 let result = getShallowRendererOutput (
5050 < Radio className = "additional" >
5151 test
@@ -56,9 +56,9 @@ describe('react/radio', function() {
5656 } ) ;
5757
5858
59- it ( 'renders properly with additional styles' , function ( ) {
59+ it ( 'renders properly with additional styles' , function ( ) {
6060 let result = getShallowRendererOutput (
61- < Radio style = { { additonal : 'style' } } >
61+ < Radio style = { { additonal : 'style' } } >
6262 test
6363 </ Radio >
6464 ) ;
@@ -67,18 +67,19 @@ describe('react/radio', function() {
6767 } ) ;
6868
6969
70- it ( 'can be used as a controlled component' , function ( ) {
70+ it ( 'can be used as a controlled component' , function ( ) {
7171 var TestApp = createClass ( {
72- getInitialState : function ( ) {
73- return { checked : this . props . checked } ;
72+ getInitialState : function ( ) {
73+ return { checked : this . props . checked } ;
7474 } ,
75- onChange : function ( ev ) {
76- this . setState ( { checked : ev . target . checked } ) ;
75+ onChange : function ( ev ) {
76+ this . setState ( { checked : ev . target . checked } ) ;
7777 } ,
78- render : function ( ) {
78+ render : function ( ) {
79+ this . elRefs = this . elRefs || { } ;
7980 return (
8081 < Radio
81- ref = " refEl"
82+ ref = { el => { this . elRefs . refEl = el ; } }
8283 checked = { this . state . checked }
8384 onChange = { this . onChange }
8485 />
@@ -88,13 +89,13 @@ describe('react/radio', function() {
8889
8990 let elem = < TestApp checked = { false } /> ;
9091 let instance = ReactUtils . renderIntoDocument ( elem ) ;
91- let inputEl = instance . refs . refEl . refs . inputEl
92+ let inputEl = instance . elRefs . refEl . elRefs . inputEl ;
9293
9394 // check default value
9495 assert . equal ( inputEl . checked , false ) ;
9596
9697 // update TestApp and check inputEl value
97- instance . setState ( { checked : true } ) ;
98+ instance . setState ( { checked : true } ) ;
9899 assert . equal ( inputEl . checked , true ) ;
99100
100101 // update inputEl and check state
@@ -104,23 +105,23 @@ describe('react/radio', function() {
104105 } ) ;
105106
106107
107- it ( 'supports onChange method' , function ( done ) {
108+ it ( 'supports onChange method' , function ( done ) {
108109 let counter = 0 ;
109110
110- let onChangeFn = function ( ) {
111+ let onChangeFn = function ( ) {
111112 counter += 1 ;
112113 } ;
113114
114115 let node = ReactUtils . renderIntoDocument (
115- < Radio onChange = { onChangeFn } />
116+ < Radio onChange = { onChangeFn } />
116117 ) ;
117118
118119 // change checkbox
119120 let inputEl = ReactUtils . findRenderedDOMComponentWithTag ( node , 'input' ) ;
120121 ReactUtils . Simulate . change ( inputEl ) ;
121122
122123 // test conditions
123- setTimeout ( function ( ) {
124+ setTimeout ( function ( ) {
124125 // one onChange event (https://github.com/muicss/mui/issues/94)
125126 assert . equal ( counter , 1 ) ;
126127
0 commit comments