Fix transliteration for metadata + transliterate select options (#5430)
## Context Fixes #5403 Transliteration is now integrated to form validation through the schema. While it does not impede inputting an invalid value, it impedes submitting a form that will fail as the transliteration is not possible. Until then we were only performing the transliteration at save time in the front-end, but it's best to provide the information as soon as possible. Later we will add helpers to guide the user (eg "This name is not valid": https://github.com/twentyhq/twenty/issues/5428). --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -0,0 +1,24 @@
|
||||
import { metadataLabelSchema } from '@/object-metadata/validation-schemas/metadataLabelSchema';
|
||||
|
||||
describe('metadataLabelSchema', () => {
|
||||
it('validates a valid label', () => {
|
||||
// Given
|
||||
const validMetadataLabel = 'Option 1';
|
||||
|
||||
// When
|
||||
const result = metadataLabelSchema.parse(validMetadataLabel);
|
||||
|
||||
// Then
|
||||
expect(result).toEqual(validMetadataLabel);
|
||||
});
|
||||
it('validates a label with non-latin characters', () => {
|
||||
// Given
|
||||
const validMetadataLabel = 'עִבְרִי';
|
||||
|
||||
// When
|
||||
const result = metadataLabelSchema.parse(validMetadataLabel);
|
||||
|
||||
// Then
|
||||
expect(result).toEqual(validMetadataLabel);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user