mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-3864] Create library - no error is displayed when name contains white spaces only (#4101)
* only spaces error message * title custom error support * tests * validate title against only spaces * generate id only when title is valid
This commit is contained in:
committed by
Eugenio Romano
parent
b035193be5
commit
7f106f7a56
@@ -214,4 +214,46 @@ describe('LibraryDialogComponent', () => {
|
||||
message: 'LIBRARY.ERRORS.CONFLICT'
|
||||
});
|
||||
}));
|
||||
|
||||
it('should not translate library title if value is not a valid id', fakeAsync(() => {
|
||||
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
|
||||
return new Promise((resolve, reject) => reject());
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
component.form.controls.title.setValue('@@@####');
|
||||
tick(500);
|
||||
flush();
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.form.controls.id.value).toBe(null);
|
||||
}));
|
||||
|
||||
it('should translate library title partially for library id', fakeAsync(() => {
|
||||
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
|
||||
return new Promise((resolve, reject) => reject());
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
component.form.controls.title.setValue('@@@####library');
|
||||
tick(500);
|
||||
flush();
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.form.controls.id.value).toBe('library');
|
||||
}));
|
||||
|
||||
it('should translate library title multiple space character to one dash for library id', fakeAsync(() => {
|
||||
spyOn(alfrescoApi.sitesApi, 'getSite').and.callFake(() => {
|
||||
return new Promise((resolve, reject) => reject());
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
component.form.controls.title.setValue('library title');
|
||||
tick(500);
|
||||
flush();
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.form.controls.id.value).toBe('library-title');
|
||||
}));
|
||||
});
|
||||
|
Reference in New Issue
Block a user