From 21a701c281ac8a3c2a63fa3bec8f0a0e001aa9bf Mon Sep 17 00:00:00 2001 From: Will Seabrook Date: Thu, 16 May 2024 03:07:31 +0100 Subject: [PATCH] feat(textarea): remove redundant props BREAKING CHANGE: removed cols, size and tooltipMessage props from the TextArea component as they were no longer doing anything fix #6107 --- .../textarea/textarea-test.stories.tsx | 9 ----- .../textarea/textarea.component.tsx | 11 ------ src/components/textarea/textarea.pw.tsx | 35 +------------------ src/components/textarea/textarea.spec.tsx | 2 -- 4 files changed, 1 insertion(+), 56 deletions(-) diff --git a/src/components/textarea/textarea-test.stories.tsx b/src/components/textarea/textarea-test.stories.tsx index bd8bd5a795..14f8659670 100644 --- a/src/components/textarea/textarea-test.stories.tsx +++ b/src/components/textarea/textarea-test.stories.tsx @@ -25,14 +25,6 @@ export default { type: "select", }, }, - cols: { - control: { - min: 0, - max: 100, - step: 1, - type: "range", - }, - }, rows: { control: { min: 0, @@ -116,7 +108,6 @@ export default { }, args: { expandable: false, - cols: 0, rows: 0, disabled: false, autoFocus: false, diff --git a/src/components/textarea/textarea.component.tsx b/src/components/textarea/textarea.component.tsx index 33e2c9dfa9..c26dbbe622 100644 --- a/src/components/textarea/textarea.component.tsx +++ b/src/components/textarea/textarea.component.tsx @@ -44,8 +44,6 @@ export interface TextareaProps characterLimit?: number; /** Type of the icon that will be rendered next to the input */ children?: React.ReactNode; - /** The visible width of the text control, in average character widths */ - cols?: number; /** If true, the component will be disabled */ disabled?: boolean; /** Indicate that error has occurred @@ -104,10 +102,6 @@ export interface TextareaProps isOptional?: boolean; /** The number of visible text lines for the control */ rows?: number; - /** One of type of size to apply to the textarea */ - size?: "small" | "medium" | "large"; - /** Message to be displayed in a Tooltip when the user hovers over the help icon */ - tooltipMessage?: string; /** Overrides the default tooltip position */ tooltipPosition?: "top" | "bottom" | "left" | "right"; /** When true, validation icon will be placed on label instead of being placed on the input */ @@ -135,7 +129,6 @@ export const Textarea = React.forwardRef( inputHint, fieldHelp, label, - size, children, characterLimit, onChange, @@ -154,7 +147,6 @@ export const Textarea = React.forwardRef( placeholder, expandable = false, rows, - cols, validationOnLabel = false, adaptiveLabelBreakpoint, inputWidth, @@ -312,7 +304,6 @@ export const Textarea = React.forwardRef( const input = ( { }); }); - ([ - [SIZE.SMALL, "32px"], - [SIZE.MEDIUM, "40px"], - [SIZE.LARGE, "48px"], - ] as [TextareaProps["size"], string][]).forEach(([size, height]) => { - test(`should use ${size} as size and render component with ${height} as height`, async ({ - mount, - page, - }) => { - await mount(); - - await expect(textarea(page)).toHaveCSS("min-height", height); - }); - }); - ([ ["flex", 399], ["flex", 400], @@ -666,20 +647,6 @@ test.describe("Props tests for Textarea component", () => { }); }); - [5, 25, 100].forEach((cols) => { - test(`should render with cols prop set to ${cols}`, async ({ - mount, - page, - }) => { - await mount(); - - await expect(textareaChildren(page)).toHaveAttribute( - "cols", - String(cols) - ); - }); - }); - [5, 25, 100].forEach((rows) => { test(`should render with rows prop set to ${rows}`, async ({ mount, diff --git a/src/components/textarea/textarea.spec.tsx b/src/components/textarea/textarea.spec.tsx index 7ccb48f3f8..5302fa7f57 100644 --- a/src/components/textarea/textarea.spec.tsx +++ b/src/components/textarea/textarea.spec.tsx @@ -523,7 +523,6 @@ describe("componentWillUnmount", () => { onChange={jest.fn()} label="Label" expandable - cols={10} rows={10} characterLimit={100} /> @@ -583,7 +582,6 @@ describe("componentWillUnmount", () => { value="foo" onChange={jest.fn()} label="Label" - cols={10} rows={10} /> );