Skip to content

Commit

Permalink
Fix Unified Data Table reset to default button when default is a numb…
Browse files Browse the repository at this point in the history
…er, and update functional tests
  • Loading branch information
davismcphee committed Oct 31, 2023
1 parent 2a08b35 commit 1bf8b3c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions test/functional/apps/discover/group2/_data_grid_row_height.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down

0 comments on commit 1bf8b3c

Please sign in to comment.