From c51ce37941686aed02603b194d4a491de65b5b0e Mon Sep 17 00:00:00 2001 From: Ariella Gilmore Date: Tue, 8 Nov 2022 08:39:28 -0800 Subject: [PATCH 1/3] fix(text-area): cols attribute (#12502) * fix(text-area): cols attribute * fix(form): remoev textArea prop cols --- .../react/__tests__/__snapshots__/PublicAPI-test.js.snap | 1 - packages/react/src/components/Form/Form.stories.js | 1 - packages/react/src/components/TextArea/TextArea-test.js | 2 +- packages/react/src/components/TextArea/TextArea.js | 8 +++++++- .../react/src/components/TextArea/TextArea.stories.js | 5 ----- packages/styles/scss/components/text-area/_text-area.scss | 2 +- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap index 10817662d2d7..ea46db287edc 100644 --- a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap +++ b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap @@ -7636,7 +7636,6 @@ Map { "TextArea" => Object { "$$typeof": Symbol(react.forward_ref), "defaultProps": Object { - "cols": 50, "disabled": false, "enableCounter": false, "helperText": "", diff --git a/packages/react/src/components/Form/Form.stories.js b/packages/react/src/components/Form/Form.stories.js index 9eaf5aa36901..41d2924f73cd 100644 --- a/packages/react/src/components/Form/Form.stories.js +++ b/packages/react/src/components/Form/Form.stories.js @@ -97,7 +97,6 @@ const textareaProps = { className: 'some-class', placeholder: 'Placeholder text', id: 'test5', - cols: 50, rows: 4, }; diff --git a/packages/react/src/components/TextArea/TextArea-test.js b/packages/react/src/components/TextArea/TextArea-test.js index 6d203263a3d7..bee02c651684 100644 --- a/packages/react/src/components/TextArea/TextArea-test.js +++ b/packages/react/src/components/TextArea/TextArea-test.js @@ -44,7 +44,7 @@ describe('TextArea', () => { }); it('should set cols as expected', () => { - expect(textarea().props().cols).toEqual(50); + expect(textarea().props().style).toEqual({ width: '100%' }); wrapper.setProps({ cols: 200 }); expect(textarea().props().cols).toEqual(200); }); diff --git a/packages/react/src/components/TextArea/TextArea.js b/packages/react/src/components/TextArea/TextArea.js index 441a4a2a0a79..5fa92e064a7a 100644 --- a/packages/react/src/components/TextArea/TextArea.js +++ b/packages/react/src/components/TextArea/TextArea.js @@ -128,6 +128,13 @@ const TextArea = React.forwardRef(function TextArea( aria-invalid={invalid || null} aria-describedby={invalid ? errorId : null} disabled={other.disabled} + style={ + other.cols + ? {} + : { + width: `100%`, + } + } /> ); @@ -268,7 +275,6 @@ TextArea.defaultProps = { onClick: () => {}, placeholder: '', rows: 4, - cols: 50, invalid: false, invalidText: '', helperText: '', diff --git a/packages/react/src/components/TextArea/TextArea.stories.js b/packages/react/src/components/TextArea/TextArea.stories.js index 5a89e26b4738..77f115e45bae 100644 --- a/packages/react/src/components/TextArea/TextArea.stories.js +++ b/packages/react/src/components/TextArea/TextArea.stories.js @@ -21,7 +21,6 @@ export const Default = () => (