Skip to content

Commit

Permalink
[Dataset quality] Introducing dataTestSubject to selectable (elastic#…
Browse files Browse the repository at this point in the history
…194008)

Relates to elastic/observability-dev#3873.

This PR aims to enable filter type to be easily targeted from FullStory.
  • Loading branch information
yngrdyn authored Sep 26, 2024
1 parent 1cd3740 commit 85e7ae9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export default function Filters() {
onIntegrationsChange={onIntegrationsChange}
/>
<Selector
dataTestSubj="datasetQualityFilterType"
label={typesLabel}
searchPlaceholder={typesSearchPlaceholder}
noneMatchingMessage={typesNoneMatching}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const selectorLoading = i18n.translate('xpack.datasetQuality.selector.loading',
});

interface SelectorProps {
dataTestSubj?: string;
isLoading?: boolean;
options: Item[];
loadingMessage?: string;
Expand All @@ -31,6 +32,7 @@ export interface Item {
}

export function Selector({
dataTestSubj = 'datasetQualitySelectable',
isLoading,
options,
loadingMessage,
Expand All @@ -50,11 +52,15 @@ export function Selector({
setIsPopoverOpen(false);
};

const renderOption = (option: Item) => <EuiText size="s">{option.label}</EuiText>;
const renderOption = (option: Item) => (
<EuiText size="s" data-test-subj={`${dataTestSubj}Option-${option.label}`}>
{option.label}
</EuiText>
);

const button = (
<EuiFilterButton
data-test-subj="datasetQualitySelectableButton"
data-test-subj={`${dataTestSubj}Button`}
iconType="arrowDown"
badgeColor="success"
onClick={onButtonClick}
Expand All @@ -75,7 +81,7 @@ export function Selector({
panelPaddingSize="none"
>
<EuiSelectable
data-test-subj="datasetQualitySelectableOptions"
data-test-subj={`${dataTestSubj}Options`}
searchable
searchProps={{
placeholder: searchPlaceholder,
Expand Down

0 comments on commit 85e7ae9

Please sign in to comment.