kopia lustrzana https://github.com/shoelace-style/shoelace
sl-tab-group throws error if unmounted too fast (#2218)
* Add check for undefined element on disconnect * Fix prettier errorkonnorrogers/add-changelog-entry-for-2218
rodzic
2c66c859d6
commit
b14498822b
|
@ -128,7 +128,10 @@ export default class SlTabGroup extends ShoelaceElement {
|
|||
disconnectedCallback() {
|
||||
super.disconnectedCallback();
|
||||
this.mutationObserver?.disconnect();
|
||||
this.resizeObserver?.unobserve(this.nav);
|
||||
|
||||
if (this.nav) {
|
||||
this.resizeObserver?.unobserve(this.nav);
|
||||
}
|
||||
}
|
||||
|
||||
private getAllTabs() {
|
||||
|
|
|
@ -84,6 +84,13 @@ describe('<sl-tab-group>', () => {
|
|||
expect(tabGroup).to.be.visible;
|
||||
});
|
||||
|
||||
it('should not throw error when unmounted too fast', async () => {
|
||||
const el = await fixture(html` <div></div> `);
|
||||
|
||||
el.innerHTML = '<sl-tab-group></sl-tab-group>';
|
||||
el.innerHTML = '';
|
||||
});
|
||||
|
||||
it('is accessible', async () => {
|
||||
const tabGroup = await fixture<SlTabGroup>(html`
|
||||
<sl-tab-group>
|
||||
|
|
Ładowanie…
Reference in New Issue