Skip to content

Commit 7d5f41f

Browse files
sorinsarcaWestbrook
authored andcommitted
fix(tabs): added test
1 parent 9742227 commit 7d5f41f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/tabs/test/tabs.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,4 +656,20 @@ describe('Tabs', () => {
656656
expect(initialWidth).to.be.greaterThan(shorterWidth);
657657
expect(longerWidth).to.be.greaterThan(shorterWidth);
658658
});
659+
it('clicks on #list do not throw', async () => {
660+
const tabs = await createTabs();
661+
const tabList = (tabs.shadowRoot as ShadowRoot).querySelector(
662+
'#list'
663+
) as HTMLDivElement;
664+
// exceptions thrown in event listeners do not propagate to caller
665+
// we must catch them with window.onerror
666+
let hasError = false;
667+
const oldOnerror = window.onerror;
668+
window.onerror = () => {
669+
hasError = true;
670+
};
671+
tabList.dispatchEvent(new MouseEvent('click'));
672+
expect(hasError, 'it should not error').to.be.false;
673+
window.onerror = oldOnerror;
674+
});
659675
});

0 commit comments

Comments
 (0)