From b23d8de5d364059c18e3e631e51232d6b62d2591 Mon Sep 17 00:00:00 2001 From: Madalena Campos Date: Tue, 11 Jul 2023 17:38:01 -0300 Subject: [PATCH] feat: add required to chip-group #734 --- projects/ion/src/lib/chip/chip.component.ts | 5 +++-- stories/ChipGroup.stories.ts | 6 ------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/projects/ion/src/lib/chip/chip.component.ts b/projects/ion/src/lib/chip/chip.component.ts index 4fc8bdb81..2b102f3e2 100644 --- a/projects/ion/src/lib/chip/chip.component.ts +++ b/projects/ion/src/lib/chip/chip.component.ts @@ -88,9 +88,10 @@ export class ChipComponent implements OnInit, AfterViewInit, DoCheck { select(): void { this.toggleDropdown(); - if (!this.options) { - !this.selected; + if (!this.options.length) { + this.selected = !this.selected; } + this.events.emit({ selected: this.selected, disabled: this.disabled, diff --git a/stories/ChipGroup.stories.ts b/stories/ChipGroup.stories.ts index d6ad4914c..d41dc1d96 100644 --- a/stories/ChipGroup.stories.ts +++ b/stories/ChipGroup.stories.ts @@ -129,9 +129,3 @@ export const WithDropdown = Template.bind({}); WithDropdown.args = { chips: chipsWithOptions, }; - -export const WithRequired = Template.bind({}); -WithRequired.args = { - chips, - required: true, -};