Merge pull request #1151 from ing-bank/fix/dialogSendMultipleOpenedChangedEvent

fix(dialog): prevent opened-changed to be sent when it is not changing
This commit is contained in:
gerjanvangeest 2020-12-21 06:55:45 +01:00 committed by GitHub
commit 679d189ec4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'@lion/overlays': patch
---
Prevent `opened-changed` event to be sent twice

View file

@ -62,7 +62,7 @@ export const OverlayMixinImplementation = superclass =>
*/
requestUpdateInternal(name, oldValue) {
super.requestUpdateInternal(name, oldValue);
if (name === 'opened') {
if (name === 'opened' && this.opened !== oldValue) {
this.dispatchEvent(new Event('opened-changed'));
}
}

View file

@ -132,6 +132,9 @@ export function runOverlayMixinSuite({ tagString, tag, suffix = '' }) {
await el.updateComplete;
expect(spy.callCount).to.equal(1);
expect(el.opened).to.be.true;
el.opened = true;
await el.updateComplete;
expect(spy.callCount).to.equal(1);
await el._overlayCtrl.hide();
await el.updateComplete;
expect(spy.callCount).to.equal(2);