diff --git a/packages/ra-ui-materialui/src/input/AutocompleteInput.spec.tsx b/packages/ra-ui-materialui/src/input/AutocompleteInput.spec.tsx
index b445fde9dc3..b722ec57158 100644
--- a/packages/ra-ui-materialui/src/input/AutocompleteInput.spec.tsx
+++ b/packages/ra-ui-materialui/src/input/AutocompleteInput.spec.tsx
@@ -408,7 +408,7 @@ describe('', () => {
it('should allow customized rendering of suggesting item', () => {
const SuggestionItem = ({ record }: { record?: any }) => (
-
+
);
const { getByLabelText, queryByLabelText } = render(
@@ -418,8 +418,8 @@ describe('', () => {
}
- inputText={record => record.name}
- matchSuggestion={(filter, choice) => true}
+ inputText={record => record && record.name}
+ matchSuggestion={() => true}
choices={[
{ id: 1, name: 'bar' },
{ id: 2, name: 'foo' },
@@ -572,4 +572,22 @@ describe('', () => {
expect(getByLabelText('My Sugggestions Container')).not.toBeNull();
});
+
+ describe('Fix issue #4660', () => {
+ it('should accept 0 as an input value', () => {
+ const { queryByDisplayValue } = render(
+