diff --git a/src/components/datagrid/controls/__snapshots__/column_sorting.test.tsx.snap b/src/components/datagrid/controls/__snapshots__/column_sorting.test.tsx.snap index 8a45ed03f72..2652cf7a9c3 100644 --- a/src/components/datagrid/controls/__snapshots__/column_sorting.test.tsx.snap +++ b/src/components/datagrid/controls/__snapshots__/column_sorting.test.tsx.snap @@ -152,7 +152,8 @@ exports[`useDataGridColumnSorting columnSorting [React 16] renders a toolbar but
- -
@@ -442,7 +429,8 @@ exports[`useDataGridColumnSorting columnSorting [React 17] renders a toolbar but
- -
@@ -732,7 +706,8 @@ exports[`useDataGridColumnSorting columnSorting [React 18] renders a toolbar but
- -
diff --git a/src/components/datagrid/controls/__snapshots__/column_sorting_draggable.test.tsx.snap b/src/components/datagrid/controls/__snapshots__/column_sorting_draggable.test.tsx.snap index a9945b92ae2..23050b9a8fa 100644 --- a/src/components/datagrid/controls/__snapshots__/column_sorting_draggable.test.tsx.snap +++ b/src/components/datagrid/controls/__snapshots__/column_sorting_draggable.test.tsx.snap @@ -87,7 +87,8 @@ exports[`EuiDataGridColumnSortingDraggable [React 16] renders an EuiDraggable co
- -
@@ -246,7 +233,8 @@ exports[`EuiDataGridColumnSortingDraggable [React 17] renders an EuiDraggable co
- -
@@ -405,7 +379,8 @@ exports[`EuiDataGridColumnSortingDraggable [React 18] renders an EuiDraggable co
- -
diff --git a/src/components/datagrid/controls/column_sorting_draggable.test.tsx b/src/components/datagrid/controls/column_sorting_draggable.test.tsx index 32bc2378214..0f275b4a79c 100644 --- a/src/components/datagrid/controls/column_sorting_draggable.test.tsx +++ b/src/components/datagrid/controls/column_sorting_draggable.test.tsx @@ -83,7 +83,9 @@ describe('EuiDataGridColumnSortingDraggable', () => { ); - fireEvent.click(getByTestSubject('columnADesc')); + fireEvent.click( + getByTestSubject('euiDataGridColumnSorting-sortColumn-columnA-desc') + ); expect(onSort).toHaveBeenCalledWith([{ id: 'columnA', direction: 'desc' }]); }); diff --git a/src/components/datagrid/controls/display_selector.test.tsx b/src/components/datagrid/controls/display_selector.test.tsx index 3fd034d88bc..6699a50d09b 100644 --- a/src/components/datagrid/controls/display_selector.test.tsx +++ b/src/components/datagrid/controls/display_selector.test.tsx @@ -77,12 +77,11 @@ describe('useDataGridDisplaySelector', () => { const component = mount(); openPopover(component); - // Click density 'buttons' (actually hidden radios) - component.find('[data-test-subj="expanded"]').simulate('change'); + component.find('button[data-test-subj="expanded"]').simulate('click'); expect(getSelection(component)).toEqual('expanded'); - component.find('[data-test-subj="normal"]').simulate('change'); + component.find('button[data-test-subj="normal"]').simulate('click'); expect(getSelection(component)).toEqual('normal'); - component.find('[data-test-subj="compact"]').simulate('change'); + component.find('button[data-test-subj="compact"]').simulate('click'); expect(getSelection(component)).toEqual('compact'); }); @@ -95,7 +94,7 @@ describe('useDataGridDisplaySelector', () => { ); openPopover(component); - component.find('[data-test-subj="expanded"]').simulate('change'); + component.find('button[data-test-subj="expanded"]').simulate('click'); expect(onDensityChange).toHaveBeenCalledWith({ stripes: true, @@ -168,7 +167,7 @@ describe('useDataGridDisplaySelector', () => { openPopover(component); expect(getSelection(component)).toEqual('expanded'); - component.find('[data-test-subj="compact"]').simulate('change'); + component.find('button[data-test-subj="compact"]').simulate('click'); expect(getSelection(component)).toEqual('compact'); component @@ -189,7 +188,7 @@ describe('useDataGridDisplaySelector', () => { openPopover(component); expect(getSelection(component)).toEqual('undefined'); - component.find('[data-test-subj="auto"]').simulate('change'); + component.find('button[data-test-subj="auto"]').simulate('click'); expect(getSelection(component)).toEqual('auto'); }); @@ -202,7 +201,7 @@ describe('useDataGridDisplaySelector', () => { ); openPopover(component); - component.find('[data-test-subj="auto"]').simulate('change'); + component.find('button[data-test-subj="auto"]').simulate('click'); expect(onRowHeightChange).toHaveBeenCalledWith({ rowHeights: {}, @@ -287,7 +286,7 @@ describe('useDataGridDisplaySelector', () => { openPopover(component); expect(getSelection(component)).toEqual('undefined'); - component.find('[data-test-subj="auto"]').simulate('change'); + component.find('button[data-test-subj="auto"]').simulate('click'); expect(getSelection(component)).toEqual('auto'); component @@ -322,7 +321,9 @@ describe('useDataGridDisplaySelector', () => { component.find('[data-test-subj="lineCountNumber"]').exists() ).toBe(false); - component.find('[data-test-subj="lineCount"]').simulate('change'); + component + .find('button[data-test-subj="lineCount"]') + .simulate('click'); expect(getSelection(component)).toEqual('lineCount'); expect( @@ -344,7 +345,9 @@ describe('useDataGridDisplaySelector', () => { it('defaults to a lineCount of 2 when no developer settings have been passed', () => { const component = mount(); openPopover(component); - component.find('[data-test-subj="lineCount"]').simulate('change'); + component + .find('button[data-test-subj="lineCount"]') + .simulate('click'); expect(getLineCountNumber(component)).toEqual(2); }); @@ -408,8 +411,8 @@ describe('useDataGridDisplaySelector', () => { component.find('[data-test-subj="resetDisplaySelector"]').exists() ).toBe(false); - component.find('[data-test-subj="expanded"]').simulate('change'); - component.find('[data-test-subj="auto"]').simulate('change'); + component.find('button[data-test-subj="expanded"]').simulate('click'); + component.find('button[data-test-subj="auto"]').simulate('click'); expect( component.find('[data-test-subj="resetDisplaySelector"]').exists() ).toBe(true); @@ -444,8 +447,8 @@ describe('useDataGridDisplaySelector', () => { component.find('[data-test-subj="resetDisplaySelector"]').exists() ).toBe(false); - component.find('[data-test-subj="expanded"]').simulate('change'); - component.find('[data-test-subj="auto"]').simulate('change'); + component.find('button[data-test-subj="expanded"]').simulate('click'); + component.find('button[data-test-subj="auto"]').simulate('click'); expect( component.find('[data-test-subj="resetDisplaySelector"]').exists() ).toBe(false); diff --git a/src/components/datagrid/data_grid.test.tsx b/src/components/datagrid/data_grid.test.tsx index c6c48e0fa77..1996aa7edbc 100644 --- a/src/components/datagrid/data_grid.test.tsx +++ b/src/components/datagrid/data_grid.test.tsx @@ -188,7 +188,7 @@ function getColumnSortDirection( expect(columnSorter.length).toBe(1); const activeSort = columnSorter.find( - 'label[className*="euiButtonGroupButton-isSelected"]' + 'button[className*="euiButtonGroupButton-isSelected"]' ); const sortDirection = ( @@ -276,10 +276,10 @@ function sortByColumn( if (currentSortDirection !== direction) { const sortButton = columnSorter.find( - `label[data-test-subj="euiDataGridColumnSorting-sortColumn-${columnId}-${direction}"]` + `button[data-test-subj="euiDataGridColumnSorting-sortColumn-${columnId}-${direction}"]` ); expect(sortButton.length).toBe(1); - sortButton.find('input').simulate('change', [undefined, direction]); + sortButton.simulate('click'); } closeColumnSorter(datagrid);