From 8363d09e79918f77b46ac1852c4849179017a758 Mon Sep 17 00:00:00 2001 From: DominikIwanek <141320833+DominikIwanek@users.noreply.github.com> Date: Thu, 15 Feb 2024 09:58:41 +0100 Subject: [PATCH] [ACS-6585] - [ACC] Removing a to be created tag, while the create tag input field has a 'Tag already exists' error, removes the error (#9338) --- .../tags-creator.component.spec.ts | 21 +++++++++++++++++++ .../tags-creator/tags-creator.component.ts | 1 + 2 files changed, 22 insertions(+) diff --git a/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.spec.ts b/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.spec.ts index f6f9b1bb5b..4c524542df 100644 --- a/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.spec.ts +++ b/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.spec.ts @@ -396,6 +396,27 @@ describe('TagsCreatorComponent', () => { expect(error).toBe('TAG.TAGS_CREATOR.ERRORS.EXISTING_TAG'); })); + it('should show error when deleting other Tag1 and Tag2 is typed and already existing tag', fakeAsync(() => { + const tag1 = 'Some tag'; + const tag2 = 'Other tag'; + + addTagToAddedList(tag1, true, 0); + tick(); + + spyOn(tagService, 'findTagByName').and.returnValue(of({ + entry: { + tag: tag2, + id: 'tag-1' + } + })); + typeTag(tag2); + component.removeTag(tag1); + tick(); + fixture.detectChanges(); + const error = getFirstError(); + expect(error).toBe('TAG.TAGS_CREATOR.ERRORS.EXISTING_TAG'); + })); + it('should error for required when not typed anything and blur input', fakeAsync(() => { component.tagNameControlVisible = true; component.tagNameControl.markAsTouched(); diff --git a/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.ts b/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.ts index c93143741f..c08df6b568 100644 --- a/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.ts +++ b/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.ts @@ -270,6 +270,7 @@ export class TagsCreatorComponent implements OnInit, OnDestroy { this.removeTagFromArray(this.tags, tag); this.tagNameControl.updateValueAndValidity(); this.updateExistingTagsListOnRemoveFromTagsToConfirm(tag); + this.exactTagSet$.next(); this.checkScrollbarVisibility(); this.tagsChange.emit(this.tags); }