Skip to content

Commit 3a96902

Browse files
committed
Remove class properties in tests
According to the proposal, class properties now require a semi-colon. We don't have these semi-colons so the build is breaking. babel/babel#3225 Changed to ES6 syntax (rather than pin the babel version or add semi-colons) to be consistent with the components in src.
1 parent 4fca3cb commit 3a96902

File tree

2 files changed

+32
-25
lines changed

2 files changed

+32
-25
lines changed

test/components/Provider.spec.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ import { Provider } from '../../src/index'
77
describe('React', () => {
88
describe('Provider', () => {
99
class Child extends Component {
10-
static contextTypes = {
11-
store: PropTypes.object.isRequired
12-
}
1310

1411
render() {
1512
return <div />
1613
}
1714
}
1815

16+
Child.contextTypes = {
17+
store: PropTypes.object.isRequired
18+
}
19+
1920
it('should enforce a single child', () => {
2021
const store = createStore(() => ({}))
2122

@@ -68,8 +69,10 @@ describe('React', () => {
6869
const store3 = createStore((state = 10) => state * state)
6970

7071
class ProviderContainer extends Component {
71-
state = { store: store1 }
72-
72+
constructor() {
73+
super()
74+
this.state = { store: store1 }
75+
}
7376
render() {
7477
return (
7578
<Provider store={this.state.store}>

test/components/connect.spec.js

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ describe('React', () => {
1414
}
1515

1616
class ProviderMock extends Component {
17-
static childContextTypes = {
18-
store: PropTypes.object.isRequired
19-
}
20-
2117
getChildContext() {
2218
return { store: this.props.store }
2319
}
@@ -27,6 +23,10 @@ describe('React', () => {
2723
}
2824
}
2925

26+
ProviderMock.childContextTypes = {
27+
store: PropTypes.object.isRequired
28+
}
29+
3030
function stringBuilder(prev = '', action) {
3131
return action.type === 'APPEND'
3232
? prev + action.body
@@ -1184,14 +1184,14 @@ describe('React', () => {
11841184

11851185
it('should hoist non-react statics from wrapped component', () => {
11861186
class Container extends Component {
1187-
static howIsRedux = () => 'Awesome!'
1188-
static foo = 'bar'
1189-
11901187
render() {
11911188
return <Passthrough />
11921189
}
11931190
}
11941191

1192+
Container.howIsRedux = () => 'Awesome!'
1193+
Container.foo = 'bar'
1194+
11951195
const decorator = connect(state => state)
11961196
const decorated = decorator(Container)
11971197

@@ -1304,25 +1304,22 @@ describe('React', () => {
13041304
const store = createStore(() => ({}))
13051305

13061306
class ImpureComponent extends Component {
1307-
static contextTypes = {
1308-
statefulValue: React.PropTypes.number
1309-
}
1310-
13111307
render() {
13121308
return <Passthrough statefulValue={this.context.statefulValue} />
13131309
}
13141310
}
13151311

1312+
ImpureComponent.contextTypes = {
1313+
statefulValue: React.PropTypes.number
1314+
}
1315+
13161316
const decorator = connect(state => state, null, null, { pure: false })
13171317
const Decorated = decorator(ImpureComponent)
13181318

13191319
class StatefulWrapper extends Component {
1320-
state = {
1321-
value: 0
1322-
}
1323-
1324-
static childContextTypes = {
1325-
statefulValue: React.PropTypes.number
1320+
constructor() {
1321+
super()
1322+
this.state = { value: 0 }
13261323
}
13271324

13281325
getChildContext() {
@@ -1336,6 +1333,10 @@ describe('React', () => {
13361333
}
13371334
}
13381335

1336+
StatefulWrapper.childContextTypes = {
1337+
statefulValue: React.PropTypes.number
1338+
}
1339+
13391340
const tree = TestUtils.renderIntoDocument(
13401341
<ProviderMock store={store}>
13411342
<StatefulWrapper />
@@ -1376,15 +1377,18 @@ describe('React', () => {
13761377
const Decorated = decorator(ImpureComponent)
13771378

13781379
class StatefulWrapper extends Component {
1379-
state = {
1380-
storeGetter: { storeKey: 'foo' }
1380+
constructor() {
1381+
super()
1382+
this.state = {
1383+
storeGetter: { storeKey: 'foo' }
1384+
}
13811385
}
1382-
13831386
render() {
13841387
return <Decorated storeGetter={this.state.storeGetter} />
13851388
}
13861389
}
13871390

1391+
13881392
const tree = TestUtils.renderIntoDocument(
13891393
<ProviderMock store={store}>
13901394
<StatefulWrapper />

0 commit comments

Comments
 (0)