jest-styled-components icon indicating copy to clipboard operation
jest-styled-components copied to clipboard

Feature request: Allow `toHaveStyleRule` to be called on global style

Open marnixhoh opened this issue 4 years ago • 0 comments

It would be great if global style as created by createGlobalStyle, could be tested in Jest using toHaveStyleRule.

For example:

let wrapper
beforeEach(() => {
    wrapper = mount(<GlobalStyle />)
})

test('Should correctly render default GlobalStyle element', () => {
    expect(wrapper).toHaveStyleRule('background-color', 'red')
    expect(wrapper).toMatchSnapshot()
})

This has been mentioned multiple times in other issues. See #324

marnixhoh avatar Jan 21 '22 09:01 marnixhoh