From b3e9690a0dd013bf01b0033f2fa0d345e3db81a7 Mon Sep 17 00:00:00 2001 From: andreasbm Date: Sat, 2 Nov 2019 22:25:00 +0100 Subject: [PATCH] Fix issue where expansion did not fire change event when checked changed. Closing #63. --- src/lib/behavior/switch/switch-behavior.ts | 2 +- src/lib/expansion/expansion.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/behavior/switch/switch-behavior.ts b/src/lib/behavior/switch/switch-behavior.ts index 33cc19d..7d50e2d 100644 --- a/src/lib/behavior/switch/switch-behavior.ts +++ b/src/lib/behavior/switch/switch-behavior.ts @@ -123,7 +123,7 @@ export abstract class SwitchBehavior extends FormElementBehavior implements ISwi // Defer the dispatching of the event until the UI on the grouped elements have updated. requestAnimationFrame(() => { - this.dispatchEvent(new CustomEvent(SwitchBehaviorEvent.CHANGE, {composed: true, bubbles: true})) + this.dispatchEvent(new CustomEvent(SwitchBehaviorEvent.CHANGE, {composed: true, bubbles: true, detail: this.checked})) }); } diff --git a/src/lib/expansion/expansion.ts b/src/lib/expansion/expansion.ts index 2ac5999..8a735fa 100644 --- a/src/lib/expansion/expansion.ts +++ b/src/lib/expansion/expansion.ts @@ -149,6 +149,7 @@ export class Expansion extends RadioBehavior implements IExpansionProperties { */ protected toggle () { this.checked = !this.checked; + this.dispatchChangeEvent(); } /**