Skip to content

Commit

Permalink
[Autocomplete] Test multiple default values
Browse files Browse the repository at this point in the history
  • Loading branch information
fenghan34 committed Nov 28, 2022
1 parent 256fd0b commit 8b92c94
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/mui-material/src/Autocomplete/Autocomplete.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,24 @@ function MyAutocomplete<
renderInput={(params) => <TextField {...params} value={params.inputProps.value} />}
/>;

interface Option {
label: string;
value: string;
}
const options: Option[] = [
{ label: '1', value: '1' },
{ label: '2', value: '2' },
];
const defaultOptions = [options[0], options[1]];
<MyAutocomplete
multiple
options={options}
defaultValue={defaultOptions}
isOptionEqualToValue={(o, v) => o.label === v.label}
getOptionLabel={(o) => o.label}
renderInput={() => null}
/>;

interface Tag {
color: string;
label: string;
Expand Down

0 comments on commit 8b92c94

Please sign in to comment.