Skip to content

Commit b57d63a

Browse files
committed
Add tests
1 parent b1f460f commit b57d63a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

packages/ra-ui-materialui/src/input/AutocompleteArrayInput.spec.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ import { SimpleForm } from '../form';
1313
import { AutocompleteArrayInput } from './AutocompleteArrayInput';
1414
import { useCreateSuggestionContext } from './useSupportCreateSuggestion';
1515
import {
16+
ChipProps,
1617
CreateItemLabel,
1718
CreateItemLabelRendered,
1819
CreateLabel,
1920
InsideReferenceArrayInput,
2021
InsideReferenceArrayInputOnChange,
2122
OnChange,
2223
OnCreate,
24+
SlotPropsChip,
2325
} from './AutocompleteArrayInput.stories';
2426

2527
describe('<AutocompleteArrayInput />', () => {
@@ -1326,4 +1328,12 @@ describe('<AutocompleteArrayInput />', () => {
13261328
expect(input.value).not.toBe('Create x');
13271329
expect(input.value).toBe('');
13281330
}, 10000);
1331+
it('should allow to customize chips using the ChipProps prop', async () => {
1332+
render(<ChipProps />);
1333+
await screen.findAllByTestId('delete-icon');
1334+
});
1335+
it('should allow to customize chips using the slotProps prop', async () => {
1336+
render(<SlotPropsChip />);
1337+
await screen.findAllByTestId('delete-icon');
1338+
});
13291339
});

packages/ra-ui-materialui/src/input/AutocompleteArrayInput.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ export const ChipProps = () => (
793793
{ id: 'u003', name: 'Reviewer' },
794794
]}
795795
ChipProps={{
796-
deleteIcon: <BackspaceIcon />,
796+
deleteIcon: <BackspaceIcon data-testid="delete-icon" />,
797797
}}
798798
/>
799799
</Wrapper>
@@ -812,7 +812,7 @@ export const SlotPropsChip = () => (
812812
slotProps={{
813813
// @ts-ignore
814814
chip: {
815-
deleteIcon: <BackspaceIcon />,
815+
deleteIcon: <BackspaceIcon data-testid="delete-icon" />,
816816
},
817817
}}
818818
/>

0 commit comments

Comments
 (0)