Skip to content

Commit

Permalink
[ACS-5021] Fixed displaying label above existing tags list (#8453)
Browse files Browse the repository at this point in the history
* ACS-5021 Fixed displaying label above existing tags list

* ACS-5021 Fixed lint issues
  • Loading branch information
AleksanderSklorz authored Apr 20, 2023
1 parent ee3f1cd commit 0ebdecb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
{{ 'TAG.TAGS_CREATOR.CREATE_TAG' | translate : { tag: tagNameControl.value } }}
</span>
<p class="adf-existing-tags-label">
{{ existingTagsLabelKey | translate }}
{{ (isOnlyCreateMode() ? 'TAG.TAGS_CREATOR.EXISTING_TAGS' : 'TAG.TAGS_CREATOR.EXISTING_TAGS_SELECTION') | translate }}
</p>
</ng-container>
<div class="adf-tags-list">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
private cancelExistingTagsLoading$ = new Subject<void>();
private existingExactTag: TagEntry;
private _existingTagsPanelVisible: boolean;
private _existingTagsLabelKey: string;

@ViewChild('tagsList')
private tagsListElement: ElementRef;
Expand Down Expand Up @@ -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.
*/
Expand Down

0 comments on commit 0ebdecb

Please sign in to comment.