1- import expect from 'expect' ;
2- import React , { PropTypes , Component } from 'react' ;
3- import TestUtils from 'react-addons-test-utils' ;
4- import { createStore } from 'redux' ;
5- import { Provider } from '../../src/index' ;
1+ import expect from 'expect'
2+ import React , { PropTypes , Component } from 'react'
3+ import TestUtils from 'react-addons-test-utils'
4+ import { createStore } from 'redux'
5+ import { Provider } from '../../src/index'
66
77describe ( 'React' , ( ) => {
88 describe ( 'Provider' , ( ) => {
@@ -12,97 +12,97 @@ describe('React', () => {
1212 }
1313
1414 render ( ) {
15- return < div /> ;
15+ return < div />
1616 }
1717 }
1818
1919 it ( 'should enforce a single child' , ( ) => {
20- const store = createStore ( ( ) => ( { } ) ) ;
20+ const store = createStore ( ( ) => ( { } ) )
2121
2222 // Ignore propTypes warnings
23- const propTypes = Provider . propTypes ;
24- Provider . propTypes = { } ;
23+ const propTypes = Provider . propTypes
24+ Provider . propTypes = { }
2525
2626 try {
2727 expect ( ( ) => TestUtils . renderIntoDocument (
2828 < Provider store = { store } >
2929 < div />
3030 </ Provider >
31- ) ) . toNotThrow ( ) ;
31+ ) ) . toNotThrow ( )
3232
3333 expect ( ( ) => TestUtils . renderIntoDocument (
3434 < Provider store = { store } >
3535 </ Provider >
36- ) ) . toThrow ( / e x a c t l y o n e c h i l d / ) ;
36+ ) ) . toThrow ( / e x a c t l y o n e c h i l d / )
3737
3838 expect ( ( ) => TestUtils . renderIntoDocument (
3939 < Provider store = { store } >
4040 < div />
4141 < div />
4242 </ Provider >
43- ) ) . toThrow ( / e x a c t l y o n e c h i l d / ) ;
43+ ) ) . toThrow ( / e x a c t l y o n e c h i l d / )
4444 } finally {
45- Provider . propTypes = propTypes ;
45+ Provider . propTypes = propTypes
4646 }
47- } ) ;
47+ } )
4848
4949 it ( 'should add the store to the child context' , ( ) => {
50- const store = createStore ( ( ) => ( { } ) ) ;
50+ const store = createStore ( ( ) => ( { } ) )
5151
52- const spy = expect . spyOn ( console , 'error' ) ;
52+ const spy = expect . spyOn ( console , 'error' )
5353 const tree = TestUtils . renderIntoDocument (
5454 < Provider store = { store } >
5555 < Child />
5656 </ Provider >
57- ) ;
58- spy . destroy ( ) ;
59- expect ( spy . calls . length ) . toBe ( 0 ) ;
57+ )
58+ spy . destroy ( )
59+ expect ( spy . calls . length ) . toBe ( 0 )
6060
61- const child = TestUtils . findRenderedComponentWithType ( tree , Child ) ;
62- expect ( child . context . store ) . toBe ( store ) ;
63- } ) ;
61+ const child = TestUtils . findRenderedComponentWithType ( tree , Child )
62+ expect ( child . context . store ) . toBe ( store )
63+ } )
6464
6565 it ( 'should warn once when receiving a new store in props' , ( ) => {
66- const store1 = createStore ( ( state = 10 ) => state + 1 ) ;
67- const store2 = createStore ( ( state = 10 ) => state * 2 ) ;
68- const store3 = createStore ( ( state = 10 ) => state * state ) ;
66+ const store1 = createStore ( ( state = 10 ) => state + 1 )
67+ const store2 = createStore ( ( state = 10 ) => state * 2 )
68+ const store3 = createStore ( ( state = 10 ) => state * state )
6969
7070 class ProviderContainer extends Component {
71- state = { store : store1 } ;
71+ state = { store : store1 }
7272
7373 render ( ) {
7474 return (
7575 < Provider store = { this . state . store } >
7676 < Child />
7777 </ Provider >
78- ) ;
78+ )
7979 }
8080 }
8181
82- const container = TestUtils . renderIntoDocument ( < ProviderContainer /> ) ;
83- const child = TestUtils . findRenderedComponentWithType ( container , Child ) ;
84- expect ( child . context . store . getState ( ) ) . toEqual ( 11 ) ;
82+ const container = TestUtils . renderIntoDocument ( < ProviderContainer /> )
83+ const child = TestUtils . findRenderedComponentWithType ( container , Child )
84+ expect ( child . context . store . getState ( ) ) . toEqual ( 11 )
8585
86- let spy = expect . spyOn ( console , 'error' ) ;
87- container . setState ( { store : store2 } ) ;
88- spy . destroy ( ) ;
86+ let spy = expect . spyOn ( console , 'error' )
87+ container . setState ( { store : store2 } )
88+ spy . destroy ( )
8989
90- expect ( child . context . store . getState ( ) ) . toEqual ( 11 ) ;
91- expect ( spy . calls . length ) . toBe ( 1 ) ;
90+ expect ( child . context . store . getState ( ) ) . toEqual ( 11 )
91+ expect ( spy . calls . length ) . toBe ( 1 )
9292 expect ( spy . calls [ 0 ] . arguments [ 0 ] ) . toBe (
9393 '<Provider> does not support changing `store` on the fly. ' +
9494 'It is most likely that you see this error because you updated to ' +
9595 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' +
9696 'automatically. See https://github.com/rackt/react-redux/releases/' +
9797 'tag/v2.0.0 for the migration instructions.'
98- ) ;
98+ )
9999
100- spy = expect . spyOn ( console , 'error' ) ;
101- container . setState ( { store : store3 } ) ;
102- spy . destroy ( ) ;
100+ spy = expect . spyOn ( console , 'error' )
101+ container . setState ( { store : store3 } )
102+ spy . destroy ( )
103103
104- expect ( child . context . store . getState ( ) ) . toEqual ( 11 ) ;
105- expect ( spy . calls . length ) . toBe ( 0 ) ;
106- } ) ;
107- } ) ;
108- } ) ;
104+ expect ( child . context . store . getState ( ) ) . toEqual ( 11 )
105+ expect ( spy . calls . length ) . toBe ( 0 )
106+ } )
107+ } )
108+ } )
0 commit comments