diff --git a/src/components/popup/popup.test.ts b/src/components/popup/popup.test.ts index d78c8e35d..d31430123 100644 --- a/src/components/popup/popup.test.ts +++ b/src/components/popup/popup.test.ts @@ -1,10 +1,33 @@ import '../../../dist/shoelace.js'; import { expect, fixture, html } from '@open-wc/testing'; +import type SlPopup from './popup.js'; describe('', () => { + let element: SlPopup; + it('should render a component', async () => { const el = await fixture(html` `); expect(el).to.exist; }); + + it('should properly handle positioning when active changes', async () => { + element = await fixture(''); + + element.active = true; + await el.updateComplete; + + // SImulate a scroll event + const event = new Event('scroll'); + window.dispatchEvent(event); + + element.active = false; + await element.updateComplete; + + // The component should not throw an error when the window is scrolled + expect(() => { + element.active = true; + window.dispatchEvent(event); + }).not.to.throw(); + }); });