[ACS-5021] Fixed displaying label above existing tags list (#8453)

* ACS-5021 Fixed displaying label above existing tags list

* ACS-5021 Fixed lint issues
This commit is contained in:
AleksanderSklorz 2023-04-20 09:43:43 +02:00 committed by GitHub
parent ee3f1cdf55
commit 0ebdecbe74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 6 deletions

View File

@ -62,7 +62,7 @@
{{ 'TAG.TAGS_CREATOR.CREATE_TAG' | translate : { tag: tagNameControl.value } }} {{ 'TAG.TAGS_CREATOR.CREATE_TAG' | translate : { tag: tagNameControl.value } }}
</span> </span>
<p class="adf-existing-tags-label"> <p class="adf-existing-tags-label">
{{ existingTagsLabelKey | translate }} {{ (isOnlyCreateMode() ? 'TAG.TAGS_CREATOR.EXISTING_TAGS' : 'TAG.TAGS_CREATOR.EXISTING_TAGS_SELECTION') | translate }}
</p> </p>
</ng-container> </ng-container>
<div class="adf-tags-list"> <div class="adf-tags-list">

View File

@ -137,6 +137,10 @@ describe('TagsCreatorComponent', () => {
return fixture.debugElement.query(By.directive(MatSelectionList)).componentInstance; 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', () => { describe('Created tags list', () => {
it('should display no tags created message after initialization', () => { it('should display no tags created message after initialization', () => {
const message = fixture.debugElement.query(By.css('.adf-no-tags-message')).nativeElement.textContent.trim(); const message = fixture.debugElement.query(By.css('.adf-no-tags-message')).nativeElement.textContent.trim();
@ -388,6 +392,20 @@ describe('TagsCreatorComponent', () => {
expect(getPanel()).toBeFalsy(); 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', () => { describe('Label for tag creation', () => {
it('should be visible', fakeAsync(() => { it('should be visible', fakeAsync(() => {
typeTag('some tag'); typeTag('some tag');

View File

@ -161,7 +161,6 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
private cancelExistingTagsLoading$ = new Subject<void>(); private cancelExistingTagsLoading$ = new Subject<void>();
private existingExactTag: TagEntry; private existingExactTag: TagEntry;
private _existingTagsPanelVisible: boolean; private _existingTagsPanelVisible: boolean;
private _existingTagsLabelKey: string;
@ViewChild('tagsList') @ViewChild('tagsList')
private tagsListElement: ElementRef; private tagsListElement: ElementRef;
@ -243,10 +242,6 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
return this._existingTagsPanelVisible; 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. * Hide input for typing name for new tag or for searching. When input is hidden then panel of existing tags is hidden as well.
*/ */