From f956a269f610c8bcd6327456c7197ad41c7ae729 Mon Sep 17 00:00:00 2001 From: Madalena Campos Date: Wed, 12 Jul 2023 17:02:35 -0300 Subject: [PATCH] fix: function adjustments #734 --- projects/ion/src/lib/chip-group/chip-group.component.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/ion/src/lib/chip-group/chip-group.component.ts b/projects/ion/src/lib/chip-group/chip-group.component.ts index f38a03abd..58f29f538 100644 --- a/projects/ion/src/lib/chip-group/chip-group.component.ts +++ b/projects/ion/src/lib/chip-group/chip-group.component.ts @@ -37,7 +37,9 @@ export class IonChipGroupComponent { this.clearChips(); } - if (!chipSelected.multiple || !isChipSelected) { + const isSingleOrSelectedChip = !chipSelected.multiple || !isChipSelected; + + if (isSingleOrSelectedChip) { chipSelected.selected = !isChipSelected; } @@ -48,7 +50,7 @@ export class IonChipGroupComponent { this.selected.emit(chipSelected); } - checkRequired(chipSelected: ChipInGroup) { + checkRequired(chipSelected: ChipInGroup): void { const selectedChips = this.chips.filter((chip) => chip.selected); if (!selectedChips.length) { chipSelected.selected = true;