fix(dialog): prevent opened-changed to be sent when it is not changing

This commit is contained in:
Mathieu Puech 2020-12-17 15:23:42 -05:00
parent 125f606f89
commit 1e2f92b2f1
2 changed files with 4 additions and 1 deletions

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);