Skip to content

Commit

Permalink
[material-ui][Input] Remove unused classes from InputClasses interface
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 committed Jan 10, 2025
1 parent 0221d17 commit cf3d292
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 26 deletions.
12 changes: 0 additions & 12 deletions docs/pages/material-ui/api/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@
"name": "Input",
"imports": ["import Input from '@mui/material/Input';", "import { Input } from '@mui/material';"],
"classes": [
{
"key": "colorSecondary",
"className": "MuiInput-colorSecondary",
"description": "Styles applied to the root element if color secondary.",
"isGlobal": false
},
{
"key": "disabled",
"className": "Mui-disabled",
Expand All @@ -93,12 +87,6 @@
"description": "Styles applied to the root element if the component is focused.",
"isGlobal": true
},
{
"key": "formControl",
"className": "MuiInput-formControl",
"description": "Styles applied to the root element if the component is a descendant of `FormControl`.",
"isGlobal": false
},
{
"key": "fullWidth",
"className": "MuiInput-fullWidth",
Expand Down
10 changes: 0 additions & 10 deletions docs/translations/api-docs/input/input.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@
}
},
"classDescriptions": {
"colorSecondary": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "color secondary"
},
"disabled": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
Expand All @@ -106,11 +101,6 @@
"nodeName": "the root element",
"conditions": "the component is focused"
},
"formControl": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "the component is a descendant of <code>FormControl</code>"
},
"fullWidth": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
Expand Down
17 changes: 17 additions & 0 deletions packages/mui-material/src/Input/Input.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { createRenderer } from '@mui/internal-test-utils';
import InputBase from '@mui/material/InputBase';
import Input, { inputClasses as classes } from '@mui/material/Input';
import describeConformance from '../../test/describeConformance';
import FormControl from '../FormControl';

describe('<Input />', () => {
const { render } = createRenderer();
Expand Down Expand Up @@ -47,4 +48,20 @@ describe('<Input />', () => {
);
expect(document.querySelector('[data-test=test]')).toHaveComputedStyle({ marginTop: '10px' });
});

it('should not have colorSecondary class on Input', () => {
render(<Input color="secondary" />);
expect(document.querySelector(`.MuiInput-colorSecondary`)).to.equal(null);
expect(document.querySelector(`.MuiInputBase-colorSecondary`)).to.not.equal(null);
});

it('should not have formControl class on Input', () => {
render(
<FormControl>
<Input />
</FormControl>,
);
expect(document.querySelector(`.MuiInput-formControl`)).to.equal(null);
expect(document.querySelector(`.MuiInputBase-formControl`)).to.not.equal(null);
});
});
4 changes: 0 additions & 4 deletions packages/mui-material/src/Input/inputClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ import { inputBaseClasses } from '../InputBase';
export interface InputClasses {
/** Styles applied to the root element. */
root: string;
/** Styles applied to the root element if the component is a descendant of `FormControl`. */
formControl: string;
/** Styles applied to the root element if the component is focused. */
focused: string;
/** Styles applied to the root element if `disabled={true}`. */
disabled: string;
/** Styles applied to the root element if color secondary. */
colorSecondary: string;
/** Styles applied to the root element unless `disableUnderline={true}`. */
underline: string;
/** State class applied to the root element if `error={true}`. */
Expand Down

0 comments on commit cf3d292

Please sign in to comment.