@@ -46,7 +46,6 @@ clear to read and to maintain.
4646<!-- START doctoc generated TOC please keep comment here to allow auto update -->
4747<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
4848
49-
5049- [ Installation] ( #installation )
5150- [ Usage] ( #usage )
5251- [ Custom matchers] ( #custom-matchers )
@@ -642,7 +641,7 @@ expect(getByTestId('login-form')).toHaveFormValues({
642641### ` toHaveStyle `
643642
644643``` typescript
645- toHaveStyle (css : string )
644+ toHaveStyle (css : string | object )
646645```
647646
648647This allows you to check if a certain element has some specific css properties
@@ -652,7 +651,10 @@ expected properties applied, not just some of them.
652651#### Examples
653652
654653``` html
655- <button data-testid =" delete-button" style =" display : none ; color : red " >
654+ <button
655+ data-testid =" delete-button"
656+ style =" display : none ; background-color : red "
657+ >
656658 Delete item
657659</button >
658660```
@@ -661,14 +663,23 @@ expected properties applied, not just some of them.
661663const button = getByTestId (' delete-button' )
662664
663665expect (button).toHaveStyle (' display: none' )
666+ expect (button).toHaveStyle ({display: ' none' })
664667expect (button).toHaveStyle (`
665- color: red;
668+ background- color: red;
666669 display: none;
667670` )
671+ expect (button).toHaveStyle ({
672+ backgroundColor: ' red' ,
673+ display: ' none' ,
674+ })
668675expect (button).not .toHaveStyle (`
669- color: blue;
676+ background- color: blue;
670677 display: none;
671678` )
679+ expect (button).not .toHaveStyle ({
680+ backgroundColor: ' blue' ,
681+ display: ' none' ,
682+ })
672683```
673684
674685This also works with rules that are applied to the element via a class name for
@@ -928,6 +939,7 @@ Thanks goes to these people ([emoji key][emojis]):
928939
929940<!-- markdownlint-enable -->
930941<!-- prettier-ignore-end -->
942+
931943<!-- ALL-CONTRIBUTORS-LIST:END -->
932944
933945This project follows the [ all-contributors] [ all-contributors ] specification.
0 commit comments