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:
commit
679d189ec4
3 changed files with 9 additions and 1 deletions
5
.changeset/silver-horses-return.md
Normal file
5
.changeset/silver-horses-return.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@lion/overlays': patch
|
||||
---
|
||||
|
||||
Prevent `opened-changed` event to be sent twice
|
||||
|
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue