()
| 5 | import { expectType } from '@mui/types'; |
| 6 | |
| 7 | function genericValueTest() { |
| 8 | function handleChangeWithSameTypeAsSelect(event: SelectChangeEvent<number>) {} |
| 9 | <Select<number> onChange={handleChangeWithSameTypeAsSelect} />; |
| 10 | |
| 11 | function handleChangeWithDifferentTypeFromSelect( |
| 12 | event: React.ChangeEvent<{ name?: string; value: string }>, |
| 13 | ) {} |
| 14 | <Select<number> |
| 15 | // @ts-expect-error |
| 16 | onChange={handleChangeWithDifferentTypeFromSelect} |
| 17 | />; |
| 18 | |
| 19 | <Select<string> |
| 20 | // @ts-expect-error defaultValue should be a string |
| 21 | defaultValue={1} |
| 22 | // @ts-expect-error Value should be a string |
| 23 | value={10} |
| 24 | />; |
| 25 | |
| 26 | <Select |
| 27 | onChange={(event) => { |
| 28 | function testString(value: string) {} |
| 29 | function testNumber(value: number) {} |
| 30 | |
| 31 | testString(event.target.value); |
| 32 | // @ts-expect-error |
| 33 | testNumber(event.target.value); |
| 34 | }} |
| 35 | value="1" |
| 36 | />; |
| 37 | |
| 38 | <Select onChange={(event) => console.log(event.target.value)} value="1"> |
| 39 | <MenuItem value="1" /> |
| 40 | {/* Whoops. The value in onChange won't be a string */} |
| 41 | <MenuItem value={2} /> |
| 42 | </Select>; |
| 43 | |
| 44 | // notched prop should be available (inherited from OutlinedInputProps) and NOT throw typescript error |
| 45 | <Select notched />; |
| 46 | |
| 47 | // disabledUnderline prop should be available (inherited from InputProps) and NOT throw typescript error |
| 48 | <Select disableUnderline />; |
| 49 | |
| 50 | // Tests presence of `root` class in SelectClasses |
| 51 | const theme = createTheme({ |
| 52 | components: { |
| 53 | MuiSelect: { |
| 54 | styleOverrides: { |
| 55 | root: { |
| 56 | borderRadius: '8px', |
| 57 | }, |
| 58 | }, |
| 59 | }, |
| 60 | }, |
| 61 | }); |
| 62 | |
| 63 | // tests deep slot prop forwarding up to the modal backdrop |
| 64 | <Select |
nothing calls this directly
no test coverage detected
searching dependent graphs…