Skip to content

feat: 🎸 DOMSelector support for query parentSelector#732

Merged
NetanelBasal merged 1 commit intongneat:masterfrom
chimurai:query-parentselector-DOMSelector-support
Oct 12, 2025
Merged

feat: 🎸 DOMSelector support for query parentSelector#732
NetanelBasal merged 1 commit intongneat:masterfrom
chimurai:query-parentselector-DOMSelector-support

Conversation

@chimurai
Copy link
Contributor

@chimurai chimurai commented Oct 11, 2025

Allow usage of byTestId(), byText(), byRole(), etc in query's parentSelector

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[x] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Currently css selector have to be used to query for data-testid attribute

spectator.query(ChildComponent, { parentSelector: '[data-testid="parent-component-1"]' });

What is the new behavior?

Support DomSelector to allow existing dom query functions to be used: byTestId(), byText(), byRole(), etc... in parentSelector

spectator.query(ChildComponent, { parentSelector: byTestId('parent-component-1') });

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Allow usage of byTestId(), byText(), byRole(), etc in query's
parentSelector
@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@NetanelBasal NetanelBasal merged commit e5616a2 into ngneat:master Oct 12, 2025
3 checks passed
@chimurai chimurai deleted the query-parentselector-DOMSelector-support branch October 12, 2025 10:31
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