You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: .within() now throws an error if given more than one subject. (#24975)
* fix: .within() now throws an error if given more than one subject.
* Fix own tests for new .within() behavior
Co-authored-by: Emily Rohrbough <[email protected]>
Copy file name to clipboardExpand all lines: packages/driver/src/cypress/error_messages.ts
+14Lines changed: 14 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2404,6 +2404,20 @@ export default {
2404
2404
message: `${cmd('within')} must be called with a function.`,
2405
2405
docsUrl: 'https://on.cypress.io/within',
2406
2406
},
2407
+
multiple_elements(args){
2408
+
return{
2409
+
message: stripIndent`
2410
+
${cmd('within')} can only be called on a single element. Your subject contained {{num}} elements. Narrow down your subject to a single element (using \`.first()\`, for example) before calling \`.within()\`.
2411
+
2412
+
To run \`.within()\` over multiple subjects, use \`.each()\`.
0 commit comments