From 27b8c763bd6be09e8eecf2e6915ad7b61a6233b0 Mon Sep 17 00:00:00 2001 From: Zeeshan Tamboli Date: Fri, 8 Mar 2024 22:05:58 +0530 Subject: [PATCH] [base-ui][material-ui][TextareaAutosize] Fix inline style not getting applied (#41369) --- .../src/TextareaAutosize/TextareaAutosize.test.tsx | 13 +++++++++++++ .../src/TextareaAutosize/TextareaAutosize.tsx | 1 + 2 files changed, 14 insertions(+) diff --git a/packages/mui-base/src/TextareaAutosize/TextareaAutosize.test.tsx b/packages/mui-base/src/TextareaAutosize/TextareaAutosize.test.tsx index 902d7757f75395..418d35795d263d 100644 --- a/packages/mui-base/src/TextareaAutosize/TextareaAutosize.test.tsx +++ b/packages/mui-base/src/TextareaAutosize/TextareaAutosize.test.tsx @@ -458,4 +458,17 @@ describe('', () => { expect(input.style).to.have.property('height', `${lineHeight * 2}px`); }); }); + + it('should apply the inline styles using the "style" prop', function test() { + if (/jsdom/.test(window.navigator.userAgent)) { + this.skip(); + } + + const { container } = render(); + const input = container.querySelector('textarea')!; + + expect(input).toHaveComputedStyle({ + backgroundColor: 'rgb(255, 255, 0)', + }); + }); }); diff --git a/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx b/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx index 1ab4d9fa1fc232..a66407f984ac5e 100644 --- a/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx +++ b/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx @@ -197,6 +197,7 @@ const TextareaAutosize = React.forwardRef(function TextareaAutosize( ref={handleRef} // Apply the rows prop to get a "correct" first SSR paint rows={minRows as number} + style={style} {...other} />