-
Notifications
You must be signed in to change notification settings - Fork 123
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
Adds regex support for CSS class assertions #451
Adds regex support for CSS class assertions #451
Conversation
This is a preparatory step before adding regex support
This is a preparatory step before adding regex support
All CSS classes must not match. If any of them match the assertion will return false. The 'hasNoClass' and 'lacksClass' alias functions now accept RegExp as well.
This update documents the newly-added RegExp support within the 'hasClass' and 'doesNotHaveClass' assertions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work!! 👍
Thanks for the review @Turbo87 🙏 |
I've opened this PR ready to merge on an Aussie Monday morning, and realised I don't have merge permissions 😆 @Turbo87 Is the PR mergeable as-is, or can I help with any extra work to get it over the line? |
whoops, sorry, forgot about this MR 🙈 |
This PR adds RegExp support to the
hasClass
anddoesNotHaveClass
assertions, as suggested in #450.Both functions now accept
string|RegExp
, in the same vein ashasText
.Each CSS class present on the target element will be matched against the RegExp, and:
hasClass
assertion to returntrue
, at least one CSS class must match; anddoesNotHaveClass
assertion to returntrue
, none of the CSS classes may matchResolves #450