From 08e93208cd9fdf2c7564778c51b8b0736c5a4797 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Mon, 27 Jan 2020 11:57:17 -0500 Subject: [PATCH 1/3] Retain className for EuiFormControlLayout.prepend nodes --- .../form_control_layout.test.tsx.snap | 15 +++++++++++++++ .../form_control_layout.test.tsx | 8 ++++++++ .../form_control_layout/form_control_layout.tsx | 9 ++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/components/form/form_control_layout/__snapshots__/form_control_layout.test.tsx.snap b/src/components/form/form_control_layout/__snapshots__/form_control_layout.test.tsx.snap index fd9442eb684..064f4817c4b 100644 --- a/src/components/form/form_control_layout/__snapshots__/form_control_layout.test.tsx.snap +++ b/src/components/form/form_control_layout/__snapshots__/form_control_layout.test.tsx.snap @@ -276,6 +276,21 @@ exports[`EuiFormControlLayout props one prepend node is rendered 1`] = ` `; +exports[`EuiFormControlLayout props one prepend node is rendered with className 1`] = ` +
+ + 1 + +
+
+`; + exports[`EuiFormControlLayout props one prepend string is rendered 1`] = `
{ expect(component).toMatchSnapshot(); }); + test('one prepend node is rendered with className', () => { + const component = render( + 1} /> + ); + + expect(component).toMatchSnapshot(); + }); + test('one prepend string is rendered', () => { const component = render(); diff --git a/src/components/form/form_control_layout/form_control_layout.tsx b/src/components/form/form_control_layout/form_control_layout.tsx index 2b8bb9bdfef..07d244cc414 100644 --- a/src/components/form/form_control_layout/form_control_layout.tsx +++ b/src/components/form/form_control_layout/form_control_layout.tsx @@ -136,8 +136,15 @@ export class EuiFormControlLayout extends Component { key: React.Key ) { return cloneElement(node, { - className: `euiFormControlLayout__${side}`, + className: classNames( + `euiFormControlLayout__${side}`, + node.props.className + ), key: key, }); + /*return cloneElement(node, { + className: `euiFormControlLayout__${side}`, + key: key, + });*/ } } From 9076d12b7e9383caa9f4d181e5c3c3d093eb1530 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Mon, 27 Jan 2020 12:03:00 -0500 Subject: [PATCH 2/3] remove dead code --- .../form/form_control_layout/form_control_layout.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/components/form/form_control_layout/form_control_layout.tsx b/src/components/form/form_control_layout/form_control_layout.tsx index 07d244cc414..8a01f0c6073 100644 --- a/src/components/form/form_control_layout/form_control_layout.tsx +++ b/src/components/form/form_control_layout/form_control_layout.tsx @@ -142,9 +142,5 @@ export class EuiFormControlLayout extends Component { ), key: key, }); - /*return cloneElement(node, { - className: `euiFormControlLayout__${side}`, - key: key, - });*/ } } From 506b91f6ceb5a4b9daf4b80ffe0e36e41dc2263c Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Mon, 27 Jan 2020 14:18:51 -0500 Subject: [PATCH 3/3] change log --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e736802114..231e242a658 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - Increased column width on `EuiTableHeaderCellCheckbox` to prevent `EuiCheckbox`'s focus ring from getting clipped in `EuiBasicTable` ([#2770](https://github.com/elastic/eui/pull/2770)) - Fixed the display of `EuiButton` within `EuiControlBar` when `fill={true}` to be more consistent with other buttons ([#2781](https://github.com/elastic/eui/pull/2781)) +- Fixed `EuiFormControlLayout` from overwriting className for `prepend` nodes. ([#2796](https://github.com/elastic/eui/pull/2796)) **Deprecations**