File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -260,8 +260,7 @@ declare namespace matchers {
260260 * @see
261261 * [testing-library/jest-dom#tohaveclass](https://github.com/testing-library/jest-dom#tohaveclass)
262262 */
263- toHaveClass ( classNames : string , options ?: { exact : boolean } ) : R
264- toHaveClass ( ...classNames : Array < string | RegExp > ) : R
263+ toHaveClass ( ...classNames : ( string | RegExp ) [ ] | [ string , options ?: { exact : boolean } ] ) : R
265264 /**
266265 * @description
267266 * This allows you to check whether the given form element has the specified displayed value (the one the
Original file line number Diff line number Diff line change @@ -31,6 +31,20 @@ describe('dom related activity', () => {
3131 expect ( screenshotPath ) . toMatch (
3232 / _ _ s c r e e n s h o t s _ _ \/ d o m .t e s t .t s \/ d o m - r e l a t e d - a c t i v i t y - r e n d e r s - d i v - 1 .p n g / ,
3333 )
34+
35+ // test typing
36+ if ( 0 ) {
37+ await expect . element ( div ) . toHaveClass ( 'x' , { exact : true } )
38+ await expect . element ( div ) . toHaveClass ( 'x' , 'y' )
39+ await expect . element ( div ) . toHaveClass ( 'x' , / y / )
40+ await expect . element ( div ) . toHaveClass ( / x / , 'y' )
41+ await expect . element ( div ) . toHaveClass ( 'x' , / y / , 'z' )
42+ await expect . element ( div ) . toHaveClass ( / x / , 'y' , / z / )
43+ // @ts -expect-error error
44+ await expect . element ( div ) . toHaveClass ( 'x' , { exact : 1234 } )
45+ // @ts -expect-error error
46+ await expect . element ( div ) . toHaveClass ( 'x' , 1234 )
47+ }
3448 } )
3549
3650 test ( 'resolves base64 screenshot' , async ( ) => {
You can’t perform that action at this time.
0 commit comments