Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/browser/jest-dom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ declare namespace matchers {
* @see
* [testing-library/jest-dom#tohaveclass](https://github.com/testing-library/jest-dom#tohaveclass)
*/
toHaveClass(classNames: string, options?: {exact: boolean}): R
toHaveClass(...classNames: Array<string | RegExp>): R
toHaveClass(...classNames: (string | RegExp)[] | [string, options?: {exact: boolean}]): R
/**
* @description
* This allows you to check whether the given form element has the specified displayed value (the one the
Expand Down
14 changes: 14 additions & 0 deletions test/browser/test/dom.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ describe('dom related activity', () => {
expect(screenshotPath).toMatch(
/__screenshots__\/dom.test.ts\/dom-related-activity-renders-div-1.png/,
)

// test typing
if (0) {
await expect.element(div).toHaveClass('x', { exact: true })
await expect.element(div).toHaveClass('x', 'y')
await expect.element(div).toHaveClass('x', /y/)
await expect.element(div).toHaveClass(/x/, 'y')
await expect.element(div).toHaveClass('x', /y/, 'z')
await expect.element(div).toHaveClass(/x/, 'y', /z/)
// @ts-expect-error error
await expect.element(div).toHaveClass('x', { exact: 1234 })
// @ts-expect-error error
await expect.element(div).toHaveClass('x', 1234)
}
})

test('resolves base64 screenshot', async () => {
Expand Down