From 1bf8b3cb6cc6609e9325de3bdfcde3e9b597d643 Mon Sep 17 00:00:00 2001 From: Davis McPhee Date: Tue, 31 Oct 2023 00:00:42 -0300 Subject: [PATCH] Fix Unified Data Table reset to default button when default is a number, and update functional tests --- .../src/hooks/use_row_heights_options.ts | 2 ++ .../apps/discover/group2/_data_grid_row_height.ts | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/kbn-unified-data-table/src/hooks/use_row_heights_options.ts b/packages/kbn-unified-data-table/src/hooks/use_row_heights_options.ts index 55eaa17c2c2ea..3df1a31aaa9d3 100644 --- a/packages/kbn-unified-data-table/src/hooks/use_row_heights_options.ts +++ b/packages/kbn-unified-data-table/src/hooks/use_row_heights_options.ts @@ -34,6 +34,8 @@ const serializeRowHeight = (rowHeight?: EuiDataGridRowHeightOption): number => { return ROWS_HEIGHT_OPTIONS.auto; } else if (typeof rowHeight === 'object' && rowHeight.lineCount) { return rowHeight.lineCount; // custom + } else if (typeof rowHeight === 'number') { + return rowHeight; } return ROWS_HEIGHT_OPTIONS.single; diff --git a/test/functional/apps/discover/group2/_data_grid_row_height.ts b/test/functional/apps/discover/group2/_data_grid_row_height.ts index 0cdfc16cb3536..109c35e25a24c 100644 --- a/test/functional/apps/discover/group2/_data_grid_row_height.ts +++ b/test/functional/apps/discover/group2/_data_grid_row_height.ts @@ -61,18 +61,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dataGrid.resetRowHeightValue(); - expect(await dataGrid.getCurrentRowHeightValue()).to.be('Auto fit'); + expect(await dataGrid.getCurrentRowHeightValue()).to.be('Custom'); - await dataGrid.changeRowHeightValue('Custom'); + await dataGrid.changeRowHeightValue('Auto fit'); await dataGrid.resetRowHeightValue(); - expect(await dataGrid.getCurrentRowHeightValue()).to.be('Auto fit'); + expect(await dataGrid.getCurrentRowHeightValue()).to.be('Custom'); }); it('should persist the selection after reloading the page', async () => { await dataGrid.clickGridSettings(); - expect(await dataGrid.getCurrentRowHeightValue()).to.be('Auto fit'); + expect(await dataGrid.getCurrentRowHeightValue()).to.be('Custom'); await dataGrid.changeRowHeightValue('Single');