feat: ensure selectors are not find in ion-page-hidden pages#17
feat: ensure selectors are not find in ion-page-hidden pages#17
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the selector helper to avoid returning elements that live under .ion-page-hidden, and adds an example + Cypress coverage to validate that behavior in the demo app.
Changes:
- Wrap
getFromSupportedSelector()results with a.ion-page-hiddenexclusion filter. - Add demo markup and Cypress tests asserting hidden-page elements are ignored.
- Update docs generation script to include a custom CNAME and reuse
make-docsin the release hook.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/helpers/get-from-supported-selector.ts | Filters out matches under .ion-page-hidden for all supported selector input types. |
| html/index.html | Adds a hidden-page example element to validate selector filtering. |
| cypress/e2e/get-from-supported-selector.spec.ts | Adds regression tests for hidden-page filtering behavior. |
| package.json | Updates TypeDoc invocation and release hook to generate docs via make-docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (isJQuery<T>(selector)) { | ||
| // selector.attr('cypress-ionic-test-id', ) | ||
| return cy.wrap(selector).should('have.class', 'hydrated'); | ||
| return filterOutHiddenPage( | ||
| cy | ||
| .wrap(selector) | ||
| .should('have.class', 'hydrated') as CypressIonicReturn<T>, | ||
| ); | ||
| } | ||
|
|
||
| return (selector as unknown as CypressIonicReturn<T>).should( | ||
| 'have.class', | ||
| 'hydrated', | ||
| return filterOutHiddenPage( | ||
| (selector as unknown as CypressIonicReturn<T>).should( | ||
| 'have.class', | ||
| 'hydrated', | ||
| ), |
There was a problem hiding this comment.
In the Chainable/JQuery branches, the .should('have.class', 'hydrated') assertion runs before filtering out .ion-page-hidden matches. This means hidden-page elements can still cause the command to fail (e.g., if a hidden match is not hydrated yet), even though the intent is to ignore them. Consider filtering out hidden-page elements first, and then only asserting hydration on the remaining elements (and skipping the hydration assertion when the filtered set is empty so callers can assert have.length, 0).
No description provided.