Skip to content

Commit

Permalink
[Autocomplete] Add missing onMouseDown type to AutocompleteRenderIn…
Browse files Browse the repository at this point in the history
…putParams (#44183)
  • Loading branch information
sai6855 authored Oct 23, 2024
1 parent 675c480 commit 888eed2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/mui-material/src/Autocomplete/Autocomplete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export interface AutocompleteRenderInputParams {
className: string;
startAdornment: React.ReactNode;
endAdornment: React.ReactNode;
onMouseDown: React.MouseEventHandler;
};
inputProps: ReturnType<ReturnType<typeof useAutocomplete>['getInputProps']>;
}
Expand Down
11 changes: 11 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,17 @@ function MyAutocomplete<
renderInput={() => null}
/>;

// Tests presence of onMouseDown prop in InputProps
<Autocomplete
options={['1', '2', '3']}
renderInput={(params) => {
expectType<React.MouseEventHandler, typeof params.InputProps.onMouseDown>(
params.InputProps.onMouseDown,
);
return <TextField {...params} />;
}}
/>;

<MyAutocomplete
options={['1', '2', '3']}
onChange={(event, value) => {
Expand Down

0 comments on commit 888eed2

Please sign in to comment.