Skip to content

toHaveStyle support passing an object #179

@tom-sherman

Description

@tom-sherman

Describe the feature you'd like:

Pass an object to the toHaveStyle matcher. The object shape would be the same as the style object in React.

This would allow the tests to match the code conventions of a project using object-based CSS-in-JS and offer type checking/code completion.

Teachability, Documentation, Adoption, Migration Strategy:

Offered as an alternative for the string function signature.

expect(element).toHaveStyle({
  padding: '10px',
  marginTop: 5
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions