-
Notifications
You must be signed in to change notification settings - Fork 13.4k
fix(): overlays now present correctly when using custom elements build #23039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d120ba3
7fb8920
b92d67e
e4c91c3
4ff1f5c
3f44ab9
2bf14fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { componentOnReady } from '../helpers'; | ||
|
|
||
| describe('componentOnReady()', () => { | ||
| it('should correctly call callback for a custom element', (done) => { | ||
| customElements.define('hello-world', class extends HTMLElement { | ||
| constructor() { | ||
liamdebeasi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| super(); | ||
| } | ||
| }); | ||
|
|
||
| const component = document.createElement('hello-world'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: use "eager-component" / "lazy-component" instead of "hello-world" ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The lazy vs non lazy difference is already noted in the name of the test, so not sure this change would make much of a difference. |
||
| componentOnReady(component, (el) => { | ||
| expect(el).toBe(component); | ||
| done(); | ||
| }) | ||
| }); | ||
|
|
||
| it('should correctly call callback for a lazy loaded component', (done) => { | ||
| const cb = jest.fn((el) => { | ||
| return new Promise((resolve) => { | ||
| setTimeout(() => resolve(el), 250); | ||
| }); | ||
| }); | ||
|
|
||
| customElements.define('hello-world', class extends HTMLElement { | ||
| constructor() { | ||
| super(); | ||
| } | ||
|
|
||
| componentOnReady() { | ||
| return cb(this); | ||
| } | ||
| }); | ||
|
|
||
| const component = document.createElement('hello-world'); | ||
| componentOnReady(component, (el) => { | ||
| expect(el).toBe(component); | ||
| expect(cb).toHaveBeenCalledTimes(1); | ||
| done(); | ||
| }) | ||
| }); | ||
| }); | ||
Uh oh!
There was an error while loading. Please reload this page.