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

Feature Request: toMatchStyleSnapshot, toMatchInlineStyleSnapshot

Open greypants opened this issue 5 years ago • 0 comments

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.

greypants avatar Oct 31 '19 13:10 greypants