From f491012fcc20dd3bc05581393a4419b532d19912 Mon Sep 17 00:00:00 2001 From: Brian Love Date: Mon, 29 Apr 2024 14:04:17 -0400 Subject: [PATCH 1/3] Fix errors reported when running tests Fix several errors reported by Jest when running tests: * Fixed "providing a disabled `button` child to the Tooltip component" * Fixed case where `Autocomplete`'s `getOptionLabel()` function returned an object instead of a string * Added `key` props to list entries in the `activeFiltersTooltip` list --- web/gui-v2/src/components/HeaderDropdown.jsx | 1 + web/gui-v2/src/components/ListViewTable.jsx | 47 ++++++++++++++------ 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/web/gui-v2/src/components/HeaderDropdown.jsx b/web/gui-v2/src/components/HeaderDropdown.jsx index b504fefc..0c5cbe24 100644 --- a/web/gui-v2/src/components/HeaderDropdown.jsx +++ b/web/gui-v2/src/components/HeaderDropdown.jsx @@ -34,6 +34,7 @@ const HeaderDropdown = ({ opt?.text_str ?? opt?.text ?? ""} id={appliedId} inputLabel={label} multiple={multiple} diff --git a/web/gui-v2/src/components/ListViewTable.jsx b/web/gui-v2/src/components/ListViewTable.jsx index 6b4225aa..38e41c8d 100644 --- a/web/gui-v2/src/components/ListViewTable.jsx +++ b/web/gui-v2/src/components/ListViewTable.jsx @@ -232,6 +232,7 @@ const GROUPS_OPTIONS = Object.entries(overallData.groups) : v.name ), + text_str: v.name, val: `GROUP:${k}`, })); @@ -782,14 +783,14 @@ const ListViewTable = ({ const [key, values] = filter; const title = columnKeyMap[key]; if ( DROPDOWN_COLUMNS.includes(key) ) { - return
  • {title}: {values.join(", ")}
  • ; + return
  • {title}: {values.join(", ")}
  • ; } else { const formatted = formatActiveSliderFilter( values, DEFAULT_FILTER_VALUES[key], SLIDER_GROWTH_COLUMNS.includes(key) ); - return
  • {title}: {formatted}
  • ; + return
  • {title}: {formatted}
  • ; } })} @@ -809,17 +810,37 @@ const ListViewTable = ({
    - - + + {/* + This span is needed because otherwise MUI complains that + ``` + You are providing a disabled `button` child to the Tooltip component. + A disabled element does not fire events. + Tooltip needs to listen to the child element's events to display the title. + ``` + even though that is exactly what we want (for the tooltip to not + fire if the button is disabled). Following MUI's insistence and + adding the then requires the `disableFocusListener` and + `disableHoverListener` props to be set as well, since otherwise + the tooltip will trigger on the disabled button. + */} + + + - +