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
This works for me also.
expect(containerStyle.getDOMNode()).toHaveStyle('opacity : 0');
I had to do this to replace
expect(getComputedStyle(checkbox.getDOMNode()).getPropertyValue('opacity')).toBe('0');
which worked when I ran the test locally in my Intellij IDE. However when I ran it using npm t it failed. Must be something to do with how getComputedStyle was being computed in the different scenarios.
toHaveStyle worked in both