Skip to content

Commit

Permalink
[Joy][Textarea] Pass textarea props from componentsProps (#34223)
Browse files Browse the repository at this point in the history
  • Loading branch information
zignis committed Sep 9, 2022
1 parent 5f13a49 commit 6a9ec13
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/mui-joy/src/Textarea/Textarea.test.tsx
Expand Up @@ -35,6 +35,21 @@ describe('Joy <Textarea />', () => {
expect(screen.getByTestId('end')).toBeVisible();
});

it('should pass props to Textarea', () => {
const { container } = render(
<Textarea
componentsProps={{
textarea: {
maxLength: 5,
},
}}
/>,
);

const textarea = container.querySelector('textarea')!;
expect(textarea).to.have.attr('maxlength', '5');
});

describe('prop: disabled', () => {
it('should have disabled classes', () => {
const { container } = render(<Textarea disabled />);
Expand Down
1 change: 1 addition & 0 deletions packages/mui-joy/src/Textarea/Textarea.tsx
Expand Up @@ -252,6 +252,7 @@ const Textarea = React.forwardRef(function Textarea(inProps, ref) {
externalSlotProps: {
minRows,
maxRows,
...componentsProps.textarea,
},
ownerState,
className: [classes.textarea, inputStateClasses],
Expand Down

0 comments on commit 6a9ec13

Please sign in to comment.