Skip to content

Commit

Permalink
[ACS-6585] - [ACC] Removing a to be created tag, while the create tag…
Browse files Browse the repository at this point in the history
… input field has a 'Tag already exists' error, removes the error (#9338)
  • Loading branch information
dominikiwanekhyland authored Feb 15, 2024
1 parent 3107380 commit 8363d09
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 8363d09

Please sign in to comment.