From 2cfd0884672d72e646e2997126ca54b628f40e6d Mon Sep 17 00:00:00 2001 From: Constance Date: Mon, 31 Oct 2022 10:02:19 -0700 Subject: [PATCH] [EuiButton] Fix multiple issues around internal EuiButtonDisplay components (#6332) * Fix text wrapper not being used for EuiI18n 'text' that pass textProps * Fix unnecessary textProps spread causing false positive for undefined/empty objs * Fix minWidth inline style not applying for 0px + use logical property * [opinionated] iconSide change: prefer DOM order over CSS order - more accessible to rtl * [cleanup] remove unnecessary/unused CSS - flex shrink is already set by EuiLoadingSpinner and EuiIcon respectively and does not need to be repeated - size CSS isn't doing anything and isn't worth keeping * Write more unit tests for EuiButtonDisplayContent * Fix EuiLoadingSpinner to not pass wildcard color values into Emotion - we should be using inline styles for non-enum props to avoid generating n/infinite Emotion classNames + add unit test for EuiButtonDisplayContent & remove unnecessary typing * write more/missing unit tests for logic within internal EuiButtonDisplay * changelog --- .../button/__snapshots__/button.test.tsx.snap | 21 ++- .../_button_display_content.test.tsx.snap | 63 ++++++++ .../button_display/_button_display.test.tsx | 137 +++++++++++++++++- .../button/button_display/_button_display.tsx | 6 +- .../_button_display_content.styles.ts | 14 -- .../_button_display_content.test.tsx | 83 ++++++++++- .../_button_display_content.tsx | 32 +--- .../__snapshots__/card_select.test.tsx.snap | 1 - .../loading_spinner.test.tsx.snap | 23 +++ .../loading/loading_spinner.styles.ts | 26 ++-- .../loading/loading_spinner.test.tsx | 15 ++ src/components/loading/loading_spinner.tsx | 12 +- upcoming_changelogs/6332.md | 4 + 13 files changed, 366 insertions(+), 71 deletions(-) create mode 100644 upcoming_changelogs/6332.md diff --git a/src/components/button/__snapshots__/button.test.tsx.snap b/src/components/button/__snapshots__/button.test.tsx.snap index c44f284ef09..cc0079dc8e6 100644 --- a/src/components/button/__snapshots__/button.test.tsx.snap +++ b/src/components/button/__snapshots__/button.test.tsx.snap @@ -156,10 +156,9 @@ exports[`EuiButton props iconSide left is rendered 1`] = ` type="button" > @@ -178,18 +177,17 @@ exports[`EuiButton props iconSide right is rendered 1`] = ` type="button" > - Content + `; @@ -203,7 +201,6 @@ exports[`EuiButton props iconSize m is rendered 1`] = ` class="emotion-euiButtonDisplayContent" > @@ -225,7 +222,6 @@ exports[`EuiButton props iconSize s is rendered 1`] = ` class="emotion-euiButtonDisplayContent" > @@ -247,7 +243,6 @@ exports[`EuiButton props iconType is rendered 1`] = ` class="emotion-euiButtonDisplayContent" > @@ -302,8 +297,9 @@ exports[`EuiButton props isLoading is rendered 1`] = ` > @@ -336,6 +332,7 @@ exports[`EuiButton props isSelected is rendered as true 1`] = ` exports[`EuiButton props minWidth is rendered 1`] = `