diff --git a/packages/ra-core/src/form/Form.tsx b/packages/ra-core/src/form/Form.tsx index acd9fbe323c..7a35638daae 100644 --- a/packages/ra-core/src/form/Form.tsx +++ b/packages/ra-core/src/form/Form.tsx @@ -50,7 +50,10 @@ export const Form = (props: FormProps) => { return ( - +
{ + it('should return the prefix', () => { + const Label = () => { + return <>{useLabelPrefix()}; + }; + render( + + + ); + screen.getByText('resource.posts.fields.title'); + }); + it('should not concatenate previous prefix', () => { + const Label = () => { + return <>{useLabelPrefix()}; + }; + render( + + + + + ); + screen.getByText('resource.comments.fields.body'); + }); +}); diff --git a/packages/ra-ui-materialui/src/input/ArrayInput/SimpleFormIterator.spec.tsx b/packages/ra-ui-materialui/src/input/ArrayInput/SimpleFormIterator.spec.tsx index e3dac119c2c..6359ff4a383 100644 --- a/packages/ra-ui-materialui/src/input/ArrayInput/SimpleFormIterator.spec.tsx +++ b/packages/ra-ui-materialui/src/input/ArrayInput/SimpleFormIterator.spec.tsx @@ -14,6 +14,7 @@ import { SimpleForm } from '../../form'; import { ArrayInput } from './ArrayInput'; import { TextInput } from '../TextInput'; import { SimpleFormIterator } from './SimpleFormIterator'; +import { Basic } from './SimpleFormIterator.stories'; describe('', () => { // bypass confirm leave form with unsaved changes @@ -978,4 +979,23 @@ describe('', () => { ); }); }); + + it('should have the correct translation keys', async () => { + render(); + const authorsTranslationKey = screen.queryByLabelText( + 'resources.books.fields.authors' + ); + + expect(authorsTranslationKey).toBeDefined(); + + const authorsNameTranslationKey = await screen.findAllByLabelText( + 'resources.books.fields.authors.name' + ); + expect(authorsNameTranslationKey).toHaveLength(2); + + const authorsRoleTranslationKey = await screen.findAllByLabelText( + 'resources.books.fields.authors.role' + ); + expect(authorsRoleTranslationKey).toHaveLength(2); + }); }); diff --git a/packages/ra-ui-materialui/src/list/filter/FilterForm.tsx b/packages/ra-ui-materialui/src/list/filter/FilterForm.tsx index 5634f114716..47e1245ed3e 100644 --- a/packages/ra-ui-materialui/src/list/filter/FilterForm.tsx +++ b/packages/ra-ui-materialui/src/list/filter/FilterForm.tsx @@ -134,7 +134,10 @@ export const FilterFormBase = (props: FilterFormBaseProps) => { ); return ( - +