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
fix: cy.contains
and should('contain')
handle backslash correctly.
#20704
Conversation
Thanks for taking the time to open a PR!
|
@@ -1277,6 +1277,36 @@ describe('src/cy/commands/assertions', () => { | |||
}) | |||
}) | |||
|
|||
// TODO: this suite should be merged with the suite above |
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.
TODO
is here because the test codes should be refactored a bit later.
The suite above format quotation marks
actually has 3 subcategories:
- format quotation marks
- format strings
- escape markdown
The name doesn't explain well about the tests.
It'll be handled after this PR is merged.
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
User facing changelog
cy.contains
andshould('contain')
handle backslash correctly.Additional details
cy.contains
andshould('contain')
doesn't work.Any implementation details to explain?
Using backslash breaks the Sizzle selectors below:
cypress/packages/driver/src/cy/chai.ts
Line 282 in b0fe8bf
cypress/packages/driver/src/dom/elements/find.ts
Line 277 in b0fe8bf
For example, strings like
<asdf\
escape the quotation marks and breaks the query.So, I escaped the quotation marks.
But I had to solve a few more problems like:
escapeQuotes
functions. => createutils/escape.ts
file and move them there.should('contain')
message are not shown correctly. => I had to escape the double quotes first.How has the user experience changed?
Before: Fails.
After: Passes.
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?