From 123f45bee4485877265a82d4443beff5476bfdf7 Mon Sep 17 00:00:00 2001 From: Constance Chen Date: Thu, 20 Jan 2022 10:36:38 -0800 Subject: [PATCH 01/12] Rename CellButtons to CellActions - to be more specific and intentional about what we're referring to --- .../datagrid/body/data_grid_cell.test.tsx | 10 ++++----- .../datagrid/body/data_grid_cell.tsx | 18 +++++++-------- ...st.tsx => data_grid_cell_actions.test.tsx} | 22 +++++++++---------- ...buttons.tsx => data_grid_cell_actions.tsx} | 14 ++++++------ 4 files changed, 32 insertions(+), 32 deletions(-) rename src/components/datagrid/body/{data_grid_cell_buttons.test.tsx => data_grid_cell_actions.test.tsx} (88%) rename src/components/datagrid/body/{data_grid_cell_buttons.tsx => data_grid_cell_actions.tsx} (91%) diff --git a/src/components/datagrid/body/data_grid_cell.test.tsx b/src/components/datagrid/body/data_grid_cell.test.tsx index 07e6bb5474c..2019b7c16ef 100644 --- a/src/components/datagrid/body/data_grid_cell.test.tsx +++ b/src/components/datagrid/body/data_grid_cell.test.tsx @@ -64,11 +64,11 @@ describe('EuiDataGridCell', () => { ); component.setState({ enableInteractions: true }); - const getCellButtons = () => component.find('EuiDataGridCellButtons'); - expect(getCellButtons()).toHaveLength(1); + const getCellActions = () => component.find('EuiDataGridCellActions'); + expect(getCellActions()).toHaveLength(1); // Should handle opening the popover - (getCellButtons().prop('onExpandClick') as Function)(); + (getCellActions().prop('onExpandClick') as Function)(); expect(mockPopoverContext.openCellPopover).toHaveBeenCalled(); // Should handle closing the popover @@ -76,9 +76,9 @@ describe('EuiDataGridCell', () => { isExpandable: true, popoverContext: { ...mockPopoverContext, popoverIsOpen: true }, }); - (getCellButtons().prop('onExpandClick') as Function)(); + (getCellActions().prop('onExpandClick') as Function)(); expect(mockPopoverContext.closeCellPopover).toHaveBeenCalledTimes(1); - (getCellButtons().prop('closePopover') as Function)(); + (getCellActions().prop('closePopover') as Function)(); expect(mockPopoverContext.closeCellPopover).toHaveBeenCalledTimes(2); }); diff --git a/src/components/datagrid/body/data_grid_cell.tsx b/src/components/datagrid/body/data_grid_cell.tsx index 7985ab91d61..b638dc8b4ec 100644 --- a/src/components/datagrid/body/data_grid_cell.tsx +++ b/src/components/datagrid/body/data_grid_cell.tsx @@ -33,9 +33,9 @@ import { EuiDataGridCellValueProps, } from '../data_grid_types'; import { - EuiDataGridCellButtons, - EuiDataGridCellPopoverButtons, -} from './data_grid_cell_buttons'; + EuiDataGridCellActions, + EuiDataGridCellPopoverActions, +} from './data_grid_cell_actions'; import { IS_JEST_ENVIRONMENT } from '../../../test'; const EuiDataGridCellContent: FunctionComponent< @@ -465,7 +465,7 @@ export class EuiDataGridCell extends Component< isDetails={true} /> - ); - if (hasCellButtons) { - if (showCellButtons) { + if (hasCellActions) { + if (showCellActions) { innerContent = (
- { +describe('EuiDataGridCellActions', () => { const requiredProps = { popoverIsOpen: false, closePopover: jest.fn(), @@ -24,7 +24,7 @@ describe('EuiDataGridCellButtons', () => { }; it('renders an expand button', () => { - const component = shallow(); + const component = shallow(); expect(component).toMatchInlineSnapshot(`
{ @@ -57,7 +57,7 @@ describe('EuiDataGridCellButtons', () => { it('renders column cell actions as `EuiButtonIcon`s', () => { const component = shallow( -
`); @@ -95,6 +91,39 @@ describe('EuiDataGridCellActions', () => { /> `); }); + + it('renders both cell actions and expand button', () => { + const component = shallow( +