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

This commit is contained in:
DominikIwanek
2024-02-15 09:58:41 +01:00
committed by GitHub
parent 31073805e7
commit 8363d09e79
2 changed files with 22 additions and 0 deletions

View File

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

View File

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