mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3855] Add minimum length to library title (#4139)
* [ADF-3855] Add minimum length to library title * update name test
This commit is contained in:
committed by
Eugenio Romano
parent
aa6ba28427
commit
46150a65f2
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"APP": {
|
"APP": {
|
||||||
"CREATE_LIBRARY": "Create Library",
|
|
||||||
"INFO_DRAWER": {
|
"INFO_DRAWER": {
|
||||||
"TITLE": "Details",
|
"TITLE": "Details",
|
||||||
"COMMENTS": "Comments",
|
"COMMENTS": "Comments",
|
||||||
|
@@ -87,7 +87,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
matTooltip="{{ 'APP.CREATE_LIBRARY' | translate }}"
|
matTooltip="{{ 'DOCUMENT_LIST.TOOLBAR.CREATE_LIBRARY' | translate }}"
|
||||||
(click)="createLibrary()">
|
(click)="createLibrary()">
|
||||||
<mat-icon>library_add</mat-icon>
|
<mat-icon>library_add</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
@@ -19,6 +19,10 @@
|
|||||||
{{ 'LIBRARY.ERRORS.TITLE_TOO_LONG' | translate }}
|
{{ 'LIBRARY.ERRORS.TITLE_TOO_LONG' | translate }}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
|
|
||||||
|
<mat-error *ngIf="form.controls['title'].hasError('minlength')">
|
||||||
|
{{ 'LIBRARY.ERRORS.TITLE_TOO_SHORT' | translate }}
|
||||||
|
</mat-error>
|
||||||
|
|
||||||
<mat-error *ngIf="form.controls['title'].errors?.message">
|
<mat-error *ngIf="form.controls['title'].errors?.message">
|
||||||
{{ form.controls['title'].errors?.message | translate }}
|
{{ form.controls['title'].errors?.message | translate }}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
|
@@ -259,4 +259,20 @@ describe('LibraryDialogComponent', () => {
|
|||||||
|
|
||||||
expect(component.form.controls.id.value).toBe('library-title');
|
expect(component.form.controls.id.value).toBe('library-title');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should invalidate library title if is too short', fakeAsync(() => {
|
||||||
|
findSitesSpy.and.returnValue(Promise.resolve(findSitesResponse));
|
||||||
|
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
|
||||||
|
return new Promise((resolve, reject) => reject());
|
||||||
|
});
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
component.form.controls.title.setValue('l');
|
||||||
|
tick(500);
|
||||||
|
flush();
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
expect(component.form.controls.title.errors['minlength']).toBeTruthy();
|
||||||
|
expect(component.form.valid).toBe(false);
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
@@ -87,6 +87,7 @@ export class LibraryDialogComponent implements OnInit, OnDestroy {
|
|||||||
title: [
|
title: [
|
||||||
Validators.required,
|
Validators.required,
|
||||||
this.forbidOnlySpaces,
|
this.forbidOnlySpaces,
|
||||||
|
Validators.minLength(2),
|
||||||
Validators.maxLength(256)
|
Validators.maxLength(256)
|
||||||
],
|
],
|
||||||
description: [Validators.maxLength(512)]
|
description: [Validators.maxLength(512)]
|
||||||
|
@@ -328,6 +328,7 @@
|
|||||||
"ID_TOO_LONG": "Use 72 characters or less for the URL name",
|
"ID_TOO_LONG": "Use 72 characters or less for the URL name",
|
||||||
"DESCRIPTION_TOO_LONG": "Use 512 characters or less for description",
|
"DESCRIPTION_TOO_LONG": "Use 512 characters or less for description",
|
||||||
"TITLE_TOO_LONG": "Use 256 characters or less for title",
|
"TITLE_TOO_LONG": "Use 256 characters or less for title",
|
||||||
|
"TITLE_TOO_SHORT": "Title must be at least 2 characters long",
|
||||||
"ILLEGAL_CHARACTERS": "Use numbers and letters only",
|
"ILLEGAL_CHARACTERS": "Use numbers and letters only",
|
||||||
"ONLY_SPACES": "Library name can't contain only spaces",
|
"ONLY_SPACES": "Library name can't contain only spaces",
|
||||||
"LIBRARY_UPDATE_ERROR": "There was an error updating library properties"
|
"LIBRARY_UPDATE_ERROR": "There was an error updating library properties"
|
||||||
|
Reference in New Issue
Block a user