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
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
Current behavior
There is a way to find element by string selector in the whole DOM document using this: spectator.query('.some-selector', { root: true })
This was suggested here #87 and added in version 4.0.0.
It's not working if you use DOMSelector instance instead of string selector spectator.query(byAltText('some text'), { root: true })
Expected behavior
Would be great to have the similar logic for DOMSelector selectors as we have with string selectors. spectator.query(byAltText('some text'), { root: true })
should return find element with alt text 'some text' through the whole document.
Minimal reproduction of the problem with instructions
When testing mat-dialog or cdk-experimental/dialog you would like to query something rendered within with DOMSelector you can't do that with spectator. You can use only string selector which is actually not always nice way.
What is the motivation / use case for changing the behavior?
Need to get some elements in OverlayContainer using spectator.query with DOMSelector selectors.
Environment
Angular version: 7.2.0
Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: XX 10.15.1
- Platform: Mac 10.14.6
Others:
Maybe it would be better to replace `root: boolean` param by `rootElement: HTMLElement | Document` param to have more flexible way to specify some elements as root for such specific cases as testing stuff rendered in CDK Overlay.
The text was updated successfully, but these errors were encountered:
Coffee-Tea
changed the title
spectator.query() with root: true does
spectator.query() with root: true does not work for DOMSelector selectors (only string selectors)
Feb 21, 2020
I'm submitting a...
Current behavior
There is a way to find element by string selector in the whole DOM document using this:
spectator.query('.some-selector', { root: true })
This was suggested here #87 and added in version 4.0.0.
It's not working if you use DOMSelector instance instead of string selector
spectator.query(byAltText('some text'), { root: true })
Expected behavior
Would be great to have the similar logic for DOMSelector selectors as we have with string selectors.
spectator.query(byAltText('some text'), { root: true })
should return find element with alt text 'some text' through the whole document.
Minimal reproduction of the problem with instructions
When testing mat-dialog or cdk-experimental/dialog you would like to query something rendered within with DOMSelector you can't do that with spectator. You can use only string selector which is actually not always nice way.
What is the motivation / use case for changing the behavior?
Need to get some elements in OverlayContainer using spectator.query with DOMSelector selectors.
Environment
The text was updated successfully, but these errors were encountered: