diff --git a/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.html b/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.html index 2f2acbbd32..7a6adc8a3d 100644 --- a/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.html +++ b/lib/content-services/src/lib/tag/tags-creator/tags-creator.component.html @@ -62,7 +62,7 @@ {{ 'TAG.TAGS_CREATOR.CREATE_TAG' | translate : { tag: tagNameControl.value } }}

- {{ existingTagsLabelKey | translate }} + {{ (isOnlyCreateMode() ? 'TAG.TAGS_CREATOR.EXISTING_TAGS' : 'TAG.TAGS_CREATOR.EXISTING_TAGS_SELECTION') | translate }}

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 a2bc0df27b..ed2c039993 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 @@ -137,6 +137,10 @@ describe('TagsCreatorComponent', () => { return fixture.debugElement.query(By.directive(MatSelectionList)).componentInstance; } + function getExistingTagsLabel(): string { + return fixture.debugElement.query(By.css('.adf-existing-tags-label')).nativeElement.textContent.trim(); + } + describe('Created tags list', () => { it('should display no tags created message after initialization', () => { const message = fixture.debugElement.query(By.css('.adf-no-tags-message')).nativeElement.textContent.trim(); @@ -388,6 +392,20 @@ describe('TagsCreatorComponent', () => { expect(getPanel()).toBeFalsy(); })); + it('should have correct label when mode is Create and Assign', fakeAsync(() => { + component.mode = TagsCreatorMode.CREATE_AND_ASSIGN; + + typeTag('some tag'); + expect(getExistingTagsLabel()).toBe('TAG.TAGS_CREATOR.EXISTING_TAGS_SELECTION'); + })); + + it('should have correct label when mode is Create', fakeAsync(() => { + component.mode = TagsCreatorMode.CREATE; + + typeTag('some tag'); + expect(getExistingTagsLabel()).toBe('TAG.TAGS_CREATOR.EXISTING_TAGS'); + })); + describe('Label for tag creation', () => { it('should be visible', fakeAsync(() => { typeTag('some tag'); 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 111e6925f4..ed378c4e4f 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 @@ -161,7 +161,6 @@ export class TagsCreatorComponent implements OnInit, OnDestroy { private cancelExistingTagsLoading$ = new Subject(); private existingExactTag: TagEntry; private _existingTagsPanelVisible: boolean; - private _existingTagsLabelKey: string; @ViewChild('tagsList') private tagsListElement: ElementRef; @@ -243,10 +242,6 @@ export class TagsCreatorComponent implements OnInit, OnDestroy { return this._existingTagsPanelVisible; } - get existingTagsLabelKey(): string { - return this._existingTagsLabelKey; - } - /** * Hide input for typing name for new tag or for searching. When input is hidden then panel of existing tags is hidden as well. */