chenglou / chenglou/react-motion

After update to 0.4.8 shapshot testing fails

Open
#454 6 comments 0 reactions 1 assignee Assigned to @nkbt View on GitHub
bug
Dominant language
JavaScript
Stars
21.9k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

after update to new version `0.4.8` test fails
![image](https://cloud.githubusercontent.com/assets/11208532/25133210/adc1ba24-2454-11e7-9636-ea557cfda7bf.png)

component code
```
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import messages from '../messages'
import { FormattedMessage } from 'react-intl'
import styles from './AddCompany.css'
import plusCompany from 'images/switcher/plus-company.svg'
import { Motion, spring } from 'react-motion'
import cx from 'classnames'

export class AddCompany extends PureComponent {

constructor(props) {
super(props)

this.state = {
isExpanded: false,
expandInProgress: false,
maxHeight: 20
}
}

onPlusClickHandler = () => {
this.setState({
isExpanded: true,
expandInProgress: true,
maxHeight: 50
})
}

onTransitionEnd = () => {
this.setState({
expandInProgress: false
})
}

handleOnAddCompanyClick = () => {
if (!this.props.disabled) {
this.props.onAddCompanyAction()
}
}

render() {
const containerClass = cx(
styles.container,
{[styles.expanded]: this.state.isExpanded}
)
const linkClass = cx(
styles.link,
{[styles.disabled]: this.props.disabled}
)
return (

{({h}) =>


{
this.state.isExpanded ? (



) : (



)}

}

)
}
}

AddCompany.propTypes = {
onAddCompanyAction: PropTypes.func.isRequired,
disabled: PropTypes.bool
}

export default AddCompany
```
test code
```
import { mount } from 'enzyme'
import toJson from 'enzyme-to-json'
...
it('component rendering', () => {
const component = mount()
expect(toJson(component)).toMatchSnapshot()
})
```
package.json
```
"react": "15.4.1",
"react-motion": "^0.4.7",
"jest": "^19.0.2",
"enzyme": "^2.7.1",
"enzyme-to-json": "^1.1.3",
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.