From 0c199e9bd0b1c713a7f382e4dc9538d51ef23519 Mon Sep 17 00:00:00 2001 From: Cee Chen <549407+cee-chen@users.noreply.github.com> Date: Wed, 15 Nov 2023 17:06:00 -0800 Subject: [PATCH] [EuiSuperSelect] Allow rendering falsy but not nullish values (#7362) --- changelogs/upcoming/7362.md | 4 + .../__snapshots__/super_select.test.tsx.snap | 709 +++--------------- .../form/super_select/super_select.test.tsx | 246 +++--- .../form/super_select/super_select.tsx | 13 +- .../super_select_control.test.tsx | 60 ++ .../super_select/super_select_control.tsx | 39 +- 6 files changed, 333 insertions(+), 738 deletions(-) create mode 100644 changelogs/upcoming/7362.md diff --git a/changelogs/upcoming/7362.md b/changelogs/upcoming/7362.md new file mode 100644 index 00000000000..e2cd43d5f44 --- /dev/null +++ b/changelogs/upcoming/7362.md @@ -0,0 +1,4 @@ +**Bug fixes** + +- Fixed `EuiSuperSelect` to render options with falsy values (false, 0, and ''), but not nullish values (undefined or null) +- Fixed `EuiSuperSelect`'s typing to allow non-string values (e.g., booleans or numbers) diff --git a/src/components/form/super_select/__snapshots__/super_select.test.tsx.snap b/src/components/form/super_select/__snapshots__/super_select.test.tsx.snap index df8c091c2b0..8430331f15c 100644 --- a/src/components/form/super_select/__snapshots__/super_select.test.tsx.snap +++ b/src/components/form/super_select/__snapshots__/super_select.test.tsx.snap @@ -1,45 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`EuiSuperSelect is rendered 1`] = ` -
- -
-
-
-
-
-`; - -exports[`EuiSuperSelect props compressed is rendered 1`] = ` +exports[`EuiSuperSelect props compressed 1`] = `
@@ -55,47 +16,7 @@ exports[`EuiSuperSelect props compressed is rendered 1`] = ` >
- - -`; - -exports[`EuiSuperSelect props custom display is propagated to dropdown 1`] = ` -
- -
-
-
-
-
- -
-
-
-
-`; - -exports[`EuiSuperSelect props options are rendered when select is open 1`] = ` -
- -
+
-
-
-
-
-