Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add toHaveClass partial option #35229

Merged
merged 3 commits into from
Mar 20, 2025

Conversation

mxschmitt
Copy link
Member

This was previously added in #15491 but reverted. The difference to the previous implementation is that its not a separate expect matcher its rather just a new option partial: boolean which is by default false. This option works when passing a string and a string[].

Relates #14117

@mxschmitt mxschmitt force-pushed the toHaveClass-partial branch from b5d4889 to 395db83 Compare March 17, 2025 11:48

This comment has been minimized.

This comment has been minimized.

@mxschmitt mxschmitt force-pushed the toHaveClass-partial branch from 395db83 to adc3ded Compare March 17, 2025 12:53

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@mxschmitt mxschmitt force-pushed the toHaveClass-partial branch 2 times, most recently from 7d89bc5 to 0a73c70 Compare March 19, 2025 10:28

This comment has been minimized.

This comment has been minimized.

@@ -1523,6 +1523,12 @@ Expected class or RegExp or a list of those.

Expected class or RegExp or a list of those.

### option: LocatorAssertions.toHaveClass.partial
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A topic for the API review: does not.toHaveClass('foo bar', { partial: true }) match the class name foo baz?

@mxschmitt mxschmitt force-pushed the toHaveClass-partial branch from 0a73c70 to 48d58d2 Compare March 20, 2025 19:16

This comment has been minimized.

Copy link
Contributor

Test results for "tests 1"

3 flaky ⚠️ [firefox-page] › tests/page/page-evaluate.spec.ts:403:3 › should throw for too deep reference chain @firefox-ubuntu-22.04-node18
⚠️ [playwright-test] › tests/ui-mode-test-watch.spec.ts:145:5 › should watch all @ubuntu-latest-node18-1
⚠️ [webkit-page] › tests/page/page-screenshot.spec.ts:345:5 › page screenshot › should work while navigating @webkit-ubuntu-22.04-node18

38797 passed, 808 skipped
✔️✔️✔️

Merge workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants