mirror of
https://github.com/shoelace-style/shoelace.git
synced 2026-01-12 02:59:13 +00:00
sl-tab-group throws error if unmounted too fast (#2218)
* Add check for undefined element on disconnect * Fix prettier error
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user