fix(collapsible): moved binding to constructor

This commit is contained in:
joquitch 2022-02-07 09:01:29 +01:00 committed by Joakim Larsson
parent 0bd47f8d6a
commit 3c9acaa77e
2 changed files with 13 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
'@lion/collapsible': patch
---
Moved binding to constructor to be be able to remove the event listener in disconnectedCallback

View file

@ -100,6 +100,14 @@ describe('<lion-collapsible>', () => {
await collapsible.updateComplete; await collapsible.updateComplete;
expect(isCollapsibleOpen).to.equal(false); expect(isCollapsibleOpen).to.equal(false);
}); });
it('opens a invoker on click even if moved once', async () => {
const collapsible = await fixture(defaultCollapsible);
collapsible.remove();
const invoker = collapsible.querySelector('[slot=invoker]');
invoker?.dispatchEvent(new Event('click'));
expect(collapsible.opened).to.equal(true);
});
}); });
describe('Accessibility', () => { describe('Accessibility', () => {