mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[ACS-8180] Error message displayed on attempt to remove a tag (#9827)
This commit is contained in:
parent
d9c014a1f0
commit
a471861356
@ -7,7 +7,6 @@
|
|||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
[formControl]="tagNameControl"
|
[formControl]="tagNameControl"
|
||||||
(keyup.enter)="addTag()"
|
(keyup.enter)="addTag()"
|
||||||
adf-auto-focus
|
|
||||||
placeholder="{{ 'TAG.TAGS_CREATOR.TAG_SEARCH_PLACEHOLDER' | translate }}"
|
placeholder="{{ 'TAG.TAGS_CREATOR.TAG_SEARCH_PLACEHOLDER' | translate }}"
|
||||||
/>
|
/>
|
||||||
<mat-error *ngIf="tagNameControl.invalid && tagNameControl.touched">{{ tagNameErrorMessageKey | translate }} </mat-error>
|
<mat-error *ngIf="tagNameControl.invalid && tagNameControl.touched">{{ tagNameErrorMessageKey | translate }} </mat-error>
|
||||||
|
@ -289,13 +289,21 @@ describe('TagsCreatorComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Tag name field', () => {
|
describe('Tag name field', () => {
|
||||||
it('should input be autofocused', fakeAsync(() => {
|
it('should input be autofocused when there are no tags present', fakeAsync(() => {
|
||||||
component.tagNameControlVisible = true;
|
component.tagNameControlVisible = true;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
tick(100);
|
tick(100);
|
||||||
expect(getNameInput()).toBe(document.activeElement as HTMLInputElement);
|
expect(getNameInput()).toBe(document.activeElement as HTMLInputElement);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should input not be autofocused when there are tags present', fakeAsync(() => {
|
||||||
|
component.tags = ['Tag 1'];
|
||||||
|
component.tagNameControlVisible = true;
|
||||||
|
fixture.detectChanges();
|
||||||
|
tick(100);
|
||||||
|
expect(getNameInput()).not.toBe(document.activeElement as HTMLInputElement);
|
||||||
|
}));
|
||||||
|
|
||||||
it('should input be autofocused after showing input second time', fakeAsync(() => {
|
it('should input be autofocused after showing input second time', fakeAsync(() => {
|
||||||
component.tagNameControlVisible = true;
|
component.tagNameControlVisible = true;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@ -94,6 +94,9 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
|
|||||||
this._existingTagsPanelVisible = true;
|
this._existingTagsPanelVisible = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.tagNameInputElement?.nativeElement?.scrollIntoView();
|
this.tagNameInputElement?.nativeElement?.scrollIntoView();
|
||||||
|
if (!this.tags.length) {
|
||||||
|
this.tagNameInputElement?.nativeElement?.focus();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this._existingTagsPanelVisible = false;
|
this._existingTagsPanelVisible = false;
|
||||||
@ -247,7 +250,7 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
removeTag(tag: string): void {
|
removeTag(tag: string): void {
|
||||||
this.removeTagFromArray(this.tags, tag);
|
this.removeTagFromArray(this.tags, tag);
|
||||||
this.tagNameControl.updateValueAndValidity();
|
this.tagNameControl.updateValueAndValidity({ emitEvent: false });
|
||||||
this.updateExistingTagsListOnRemoveFromTagsToConfirm(tag);
|
this.updateExistingTagsListOnRemoveFromTagsToConfirm(tag);
|
||||||
this.exactTagSet$.next();
|
this.exactTagSet$.next();
|
||||||
this.checkScrollbarVisibility();
|
this.checkScrollbarVisibility();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user