-
-
Notifications
You must be signed in to change notification settings - Fork 835
bug: In spec tests : ReferenceError: ShadowRoot is not defined #3260
Copy link
Copy link
Closed
ionic-team/ionic-framework
#29666Labels
Bug: ValidatedThis PR or Issue is verified to be a bug within StencilThis PR or Issue is verified to be a bug within Stencil
Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Stencil Version
2.14.0
Current Behavior
this.el.getRootNode() instanceof ShadowRoot
I try to know if my custom component is in a shadowDOM.
It works well but not in specs test.
I have this error ReferenceError: ShadowRoot is not defined
Expected Behavior
No error in test when we use ShadowRoot
Steps to Reproduce
Try to test if the host element is in a shadowDOM context
this.el.getRootNode() instanceof ShadowRoot
Then run unit tests.
Code Reproduction URL
https://github.com/ryuran/stencil-bugs
Additional Information
npm inpm test
Workaround
Mock:
global.DocumentFragment = class DocumentFragment extends Node {};
global.ShadowRoot = class ShadowRoot extends DocumentFragment {};
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Bug: ValidatedThis PR or Issue is verified to be a bug within StencilThis PR or Issue is verified to be a bug within Stencil