jest-styled-components
jest-styled-components copied to clipboard
Feature Request: toMatchStyleSnapshot, toMatchInlineStyleSnapshot
I'd be great to have an API to take snapshots of just styles or specific rules. The API would be basically the same as toHaveStyleRule
, but would do snapshot generation/matching instead.
// All styles as normal snapshot
expect(component).toMatchStyleSnapshot()
// Single rule as inline snapshot
expect(component).toMatchInlineStyleSnapshot('transform')
That would prevent users from having to manually record the output, and is much more terse than taking a snapshot of the entire DOM tree and every style.