I am trying to test a style attribute for a React component. What is the best way to get style params in the test?
At this moment, my best option is to test if the H
For me, it was a mash-up for a few answers. For those also using Jest / Enzyme:
let containerStyle = wrapper.find('#item-id').get(0).props.style;
expect(containerStyle).toHaveProperty('opacity', '1'); // ('propert', 'value')
Note:
ShallowWrapper so we need to .get(0) the first matching element.props is an attribute not a function in this instancetoHaveProperty not to.have.property