Skip to content
Snippets Groups Projects
Commit b4fe43c4 authored by Jure's avatar Jure
Browse files

Merge branch 'fix-set-state' into 'master'

Fix react/no-did-mount-set-state lint error

See merge request pubsweet/pubsweet!28
parents 935cd095 4b039298
No related branches found
No related tags found
No related merge requests found
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
"no-shadow": 0, "no-shadow": 0,
"no-underscore-dangle": 0, "no-underscore-dangle": 0,
"react/forbid-prop-types": 0, "react/forbid-prop-types": 0,
"react/no-did-mount-set-state": 0,
"react/no-unused-prop-types": 0, "react/no-unused-prop-types": 0,
"react/no-unused-state": 0, "react/no-unused-state": 0,
"react/prop-types": 0, "react/prop-types": 0,
......
...@@ -30,7 +30,7 @@ export class UpdateSubscriber extends Component { ...@@ -30,7 +30,7 @@ export class UpdateSubscriber extends Component {
this.listeners = {} this.listeners = {}
} }
componentDidMount() { componentWillMount() {
this.subscribe(this.props) this.subscribe(this.props)
this.setState({ visible: UpdateSubscriber.visible() }) this.setState({ visible: UpdateSubscriber.visible() })
} }
......
...@@ -7,12 +7,9 @@ import { UpdateSubscriber } from '../../src/components/UpdateSubscriber' ...@@ -7,12 +7,9 @@ import { UpdateSubscriber } from '../../src/components/UpdateSubscriber'
global.PUBSWEET_COMPONENTS = [] global.PUBSWEET_COMPONENTS = []
function makeWrapper(props = {}) { function makeWrapper(props = {}) {
const wrapper = shallow( return shallow(
<UpdateSubscriber currentUser={{}} handleUpdate={jest.fn()} {...props} />, <UpdateSubscriber currentUser={{}} handleUpdate={jest.fn()} {...props} />,
) )
// did* lifecycle methods don't get automatically called on shallow render
wrapper.instance().componentDidMount()
return wrapper
} }
describe('<UpdateSubscriber/>', () => { describe('<UpdateSubscriber/>', () => {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment