Skip to content

Commit

Permalink
ACS-6085 Rename error translation key for required error
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksanderSklorz committed Oct 16, 2023
1 parent c3cb2fc commit 717c297
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion projects/aca-content/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@
"CONFLICT": "This Library ID is already used. Check the trashcan.",
"ID_TOO_LONG": "Use 72 characters or less for the URL name",
"DESCRIPTION_TOO_LONG": "Use 512 characters or less for description",
"TITLE_TOO_LONG": "Use 256 characters or less for title",
"TITLE_TOO_LONG_OR_MISSING": "Use 256 characters or less for title",
"ILLEGAL_CHARACTERS": "Use numbers and letters only",
"ONLY_SPACES": "Library name can't contain only spaces",
"LIBRARY_UPDATE_ERROR": "There was an error updating library properties"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,13 @@ describe('LibraryMetadataFormComponent', () => {
component.ngOnInit();

component.form.controls.title.setValue('t'.repeat(257));
expect(component.titleErrorTranslationKey).toBe('LIBRARY.ERRORS.TITLE_TOO_LONG');
expect(component.titleErrorTranslationKey).toBe('LIBRARY.ERRORS.TITLE_TOO_LONG_OR_MISSING');
});

it('should set proper titleErrorTranslationKey when there is error for missing title', () => {
component.ngOnInit();

component.form.controls.title.setValue('');
expect(component.titleErrorTranslationKey).toBe('LIBRARY.ERRORS.TITLE_TOO_LONG_OR_MISSING');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ export class LibraryMetadataFormComponent implements OnInit, OnChanges, OnDestro
.pipe(takeUntil(this.onDestroy$))
.subscribe(
() =>
(this._titleErrorTranslationKey = this.form.controls.title.errors?.empty ? 'LIBRARY.ERRORS.ONLY_SPACES' : 'LIBRARY.ERRORS.TITLE_TOO_LONG')
(this._titleErrorTranslationKey = this.form.controls.title.errors?.empty
? 'LIBRARY.ERRORS.ONLY_SPACES'
: 'LIBRARY.ERRORS.TITLE_TOO_LONG_OR_MISSING')
);
this.form.controls['title'].valueChanges
.pipe(
Expand Down

0 comments on commit 717c297

Please sign in to comment.