diff --git a/static/app/components/core/compactSelect/composite.spec.tsx b/static/app/components/core/compactSelect/composite.spec.tsx index c1a55a70f630bd..20a67debd506e8 100644 --- a/static/app/components/core/compactSelect/composite.spec.tsx +++ b/static/app/components/core/compactSelect/composite.spec.tsx @@ -5,7 +5,10 @@ import {CompositeSelect} from './composite'; describe('CompactSelect', () => { it('renders', async () => { render( - + } + > { it('renders disabled trigger button', async () => { render( - + }> { // focus state. This test ensures that focus moves seamlessly between regions. it('manages focus between regions', async () => { render( - + }> { const region1Mock = jest.fn(); const region2Mock = jest.fn(); render( - + }> { // select Choice One await userEvent.click(screen.getByRole('option', {name: 'Choice One'})); - // Region 1's callback is called, and trigger label is updated + // Region 1's callback is called expect(region1Mock).toHaveBeenCalledWith({value: 'choice_one', label: 'Choice One'}); - expect(screen.getByRole('button', {name: 'Choice One'})).toBeInTheDocument(); // open the menu again await userEvent.click(screen.getByRole('button')); @@ -209,12 +211,15 @@ describe('CompactSelect', () => { expect(region2Mock).toHaveBeenCalledWith([ {value: 'choice_three', label: 'Choice Three'}, ]); - expect(screen.getByRole('button', {name: 'Choice One +1'})).toBeInTheDocument(); }); it('can search', async () => { render( - + } + > { it('works with grid lists', async () => { render( - + }> { it('can use numbers as values', async () => { const onChange = jest.fn(); render( - + }> { options.

, - size: 'sm', - }} + trigger={props => ( + + )} > { , - children: 'Composite Select Single Select', - showChevron: false, - }} + trigger={props => ( + + )} > { /** * The "regions" inside this composite selector. Each region functions as a separated, * self-contained selectable list (each renders as a `ul` with its own list state) * whose values don't interfere with one another. */ children: CompositeSelectChild | CompositeSelectChild[]; + trigger: NonNullable; } /** diff --git a/static/app/views/insights/crons/components/overviewTimeline/sortSelector.tsx b/static/app/views/insights/crons/components/overviewTimeline/sortSelector.tsx index 1a084508a403a6..ec92c2f818ed1f 100644 --- a/static/app/views/insights/crons/components/overviewTimeline/sortSelector.tsx +++ b/static/app/views/insights/crons/components/overviewTimeline/sortSelector.tsx @@ -3,6 +3,7 @@ import { type CompositeSelectProps, } from 'sentry/components/core/compactSelect/composite'; import type {SelectOption} from 'sentry/components/core/compactSelect/types'; +import DropdownButton from 'sentry/components/dropdownButton'; import {IconSort} from 'sentry/icons'; import {t} from 'sentry/locale'; import {useLocation} from 'sentry/utils/useLocation'; @@ -77,12 +78,16 @@ export function SortSelector({onChangeOrder, onChangeSort, order, sort, size}: P return ( , - children: `${label} \u2014 ${orderLabel}`, - }} + trigger={props => ( + } + prefix={t('Sort By')} + {...props} + > + {`${label} \u2014 ${orderLabel}`} + + )} > , size: 'md', children: t('Filter')}} + trigger={props => ( + }> + {t('Filter')} + + )} maxMenuHeight="22rem" size="sm" >