Skip to content

Commit

Permalink
Remove class properties in tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ellbee committed Jan 19, 2016
1 parent 4fca3cb commit 3a96902
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 25 deletions.
13 changes: 8 additions & 5 deletions test/components/Provider.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ import { Provider } from '../../src/index'
describe('React', () => {
describe('Provider', () => {
class Child extends Component {
static contextTypes = {
store: PropTypes.object.isRequired
}

render() {
return <div />
}
}

Child.contextTypes = {
store: PropTypes.object.isRequired
}

it('should enforce a single child', () => {
const store = createStore(() => ({}))

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

class ProviderContainer extends Component {
state = { store: store1 }

constructor() {
super()
this.state = { store: store1 }
}
render() {
return (
<Provider store={this.state.store}>
Expand Down
44 changes: 24 additions & 20 deletions test/components/connect.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ describe('React', () => {
}

class ProviderMock extends Component {
static childContextTypes = {
store: PropTypes.object.isRequired
}

getChildContext() {
return { store: this.props.store }
}
Expand All @@ -27,6 +23,10 @@ describe('React', () => {
}
}

ProviderMock.childContextTypes = {
store: PropTypes.object.isRequired
}

function stringBuilder(prev = '', action) {
return action.type === 'APPEND'
? prev + action.body
Expand Down Expand Up @@ -1184,14 +1184,14 @@ describe('React', () => {

it('should hoist non-react statics from wrapped component', () => {
class Container extends Component {
static howIsRedux = () => 'Awesome!'
static foo = 'bar'

render() {
return <Passthrough />
}
}

Container.howIsRedux = () => 'Awesome!'
Container.foo = 'bar'

const decorator = connect(state => state)
const decorated = decorator(Container)

Expand Down Expand Up @@ -1304,25 +1304,22 @@ describe('React', () => {
const store = createStore(() => ({}))

class ImpureComponent extends Component {
static contextTypes = {
statefulValue: React.PropTypes.number
}

render() {
return <Passthrough statefulValue={this.context.statefulValue} />
}
}

ImpureComponent.contextTypes = {
statefulValue: React.PropTypes.number
}

const decorator = connect(state => state, null, null, { pure: false })
const Decorated = decorator(ImpureComponent)

class StatefulWrapper extends Component {
state = {
value: 0
}

static childContextTypes = {
statefulValue: React.PropTypes.number
constructor() {
super()
this.state = { value: 0 }
}

getChildContext() {
Expand All @@ -1336,6 +1333,10 @@ describe('React', () => {
}
}

StatefulWrapper.childContextTypes = {
statefulValue: React.PropTypes.number
}

const tree = TestUtils.renderIntoDocument(
<ProviderMock store={store}>
<StatefulWrapper />
Expand Down Expand Up @@ -1376,15 +1377,18 @@ describe('React', () => {
const Decorated = decorator(ImpureComponent)

class StatefulWrapper extends Component {
state = {
storeGetter: { storeKey: 'foo' }
constructor() {
super()
this.state = {
storeGetter: { storeKey: 'foo' }
}
}

render() {
return <Decorated storeGetter={this.state.storeGetter} />
}
}


const tree = TestUtils.renderIntoDocument(
<ProviderMock store={store}>
<StatefulWrapper />
Expand Down

1 comment on commit 3a96902

@gaearon
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Please sign in to comment.