Skip to content

Commit

Permalink
[8.x] Upgrade EUI to v95.11.0 (#192756) (#193803)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [Upgrade EUI to v95.11.0
(#192756)](#192756)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Cee
Chen","email":"549407+cee-chen@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-09-23T22:45:19Z","message":"Upgrade
EUI to v95.11.0 (#192756)\n\n`v95.10.1`⏩`v95.11.0`\r\n\r\n> [!note]\r\n>
The bulk of this release is **EuiDataGrid**. The component has
been\r\nfully converted to Emotion, and several UX changes have been
made to\r\ndata cell actions. We recommend QA testing any data grid(s)
that have\r\ncustom styles applied to them.\r\n\r\n_[Questions? Please
see our Kibana
upgrade\r\nFAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_\r\n\r\n---\r\n\r\n##
[`v95.11.0`](https://github.com/elastic/eui/releases/v95.11.0)\r\n\r\n-
Updated `EuiText`, `EuiTextColor`, and `EuiTextAlign` with a
new\r\n`component` prop that allows changing the default rendered
`<div>`\r\nwrapper to a `<span>` or `<p>`
tag.\r\n([#7993](https://github.com/elastic/eui/pull/7993))\r\n- Updated
`EuiDataGrid`'s cell actions to always consistently be\r\nleft-aligned,
regardless of text content
alignment\r\n([#8011](https://github.com/elastic/eui/pull/8011))\r\n-
Increased `EuiDataGrid`'s cell actions hover zone to reduce
UX\r\nfriction when mousing over from the grid cell to its
actions\r\n([#8011](https://github.com/elastic/eui/pull/8011))\r\n\r\n**Bug
fixes**\r\n\r\n- Fixed `EuiPopover` to correctly inherit from
`EuiProvider`'s\r\n`componentDefaults.EuiPortal.insert`\r\n([#8003](https://github.com/elastic/eui/pull/8003))\r\n-
Fixed push `EuiFlyoutResizable`s to not potentially block
scrollbars\r\non outside content
([#8010](https://github.com/elastic/eui/pull/8010))\r\n- Fixed an
`EuiDataGrid` bug where the `setCellProps` callback passed
by\r\n`renderCellValue` was not correctly applying custom
`data-test-subj`s\r\n([#8011](https://github.com/elastic/eui/pull/8011))\r\n\r\n**Accessibility**\r\n\r\n-
Updated the `EuiBasicTable` actions button's `aria-label` by adding
a\r\nreference to the current
row\r\n([#7994](https://github.com/elastic/eui/pull/7994))\r\n\r\n**CSS-in-JS
conversions**\r\n\r\n- Converted `EuiDataGrid`'s toolbar controls to
Emotion\r\n([#7997](https://github.com/elastic/eui/pull/7997))\r\n -
Removed `$euiDataGridPopoverMaxHeight`\r\n- Converted `EuiDataGrid` to
Emotion\r\n([#7998](https://github.com/elastic/eui/pull/7998))\r\n -
Removed `$euiZDataGrid`\r\n - Removed `$euiZHeaderBelowDataGrid`\r\n-
Converted `EuiDataGrid`'s `gridStyle`s to Emotion; Removed
the\r\nfollowing Sass variables and
mixins:\r\n([#8006](https://github.com/elastic/eui/pull/8006))\r\n -
`$euiDataGridCellPaddingS`\r\n - `$euiDataGridCellPaddingM`\r\n -
`$euiDataGridCellPaddingL`\r\n - `$euiDataGridVerticalBorder`\r\n -
`$euiDataGridPrefix`\r\n - `$euiDataGridStyles`\r\n -
`@euiDataGridSelector`\r\n - `@euiDataGridStyles`\r\n- Converted
`EuiDataGrid`'s cell popover, actions, and focus outline to\r\nEmotion;
Removed the following Sass variables and
mixins:\r\n([#8011](https://github.com/elastic/eui/pull/8011))\r\n -
`$euiZDataGridCellPopover`\r\n - `@euiDataGridCellFocus`\r\n- Converted
`EuiDataGrid`'s row, header, and footer cells to Emotion;\r\nRemoved the
following Sass variables and
mixins:\r\n([#8013](https://github.com/elastic/eui/pull/8013))\r\n -
`$euiDataGridColumnResizerWidth`\r\n - `@euiDataGridRowCell`\r\n -
`@euiDataGridHeaderCell`\r\n -
`@euiDataGridFooterCell`","sha":"9bbb296078ea385561d46819001644cdb4fdc714","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","EUI","v9.0.0","ci:project-deploy-observability","Team:obs-ux-management","v8.16.0","backport:version"],"title":"Upgrade
EUI to
v95.11.0","number":192756,"url":"https://github.com/elastic/kibana/pull/192756","mergeCommit":{"message":"Upgrade
EUI to v95.11.0 (#192756)\n\n`v95.10.1`⏩`v95.11.0`\r\n\r\n> [!note]\r\n>
The bulk of this release is **EuiDataGrid**. The component has
been\r\nfully converted to Emotion, and several UX changes have been
made to\r\ndata cell actions. We recommend QA testing any data grid(s)
that have\r\ncustom styles applied to them.\r\n\r\n_[Questions? Please
see our Kibana
upgrade\r\nFAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_\r\n\r\n---\r\n\r\n##
[`v95.11.0`](https://github.com/elastic/eui/releases/v95.11.0)\r\n\r\n-
Updated `EuiText`, `EuiTextColor`, and `EuiTextAlign` with a
new\r\n`component` prop that allows changing the default rendered
`<div>`\r\nwrapper to a `<span>` or `<p>`
tag.\r\n([#7993](https://github.com/elastic/eui/pull/7993))\r\n- Updated
`EuiDataGrid`'s cell actions to always consistently be\r\nleft-aligned,
regardless of text content
alignment\r\n([#8011](https://github.com/elastic/eui/pull/8011))\r\n-
Increased `EuiDataGrid`'s cell actions hover zone to reduce
UX\r\nfriction when mousing over from the grid cell to its
actions\r\n([#8011](https://github.com/elastic/eui/pull/8011))\r\n\r\n**Bug
fixes**\r\n\r\n- Fixed `EuiPopover` to correctly inherit from
`EuiProvider`'s\r\n`componentDefaults.EuiPortal.insert`\r\n([#8003](https://github.com/elastic/eui/pull/8003))\r\n-
Fixed push `EuiFlyoutResizable`s to not potentially block
scrollbars\r\non outside content
([#8010](https://github.com/elastic/eui/pull/8010))\r\n- Fixed an
`EuiDataGrid` bug where the `setCellProps` callback passed
by\r\n`renderCellValue` was not correctly applying custom
`data-test-subj`s\r\n([#8011](https://github.com/elastic/eui/pull/8011))\r\n\r\n**Accessibility**\r\n\r\n-
Updated the `EuiBasicTable` actions button's `aria-label` by adding
a\r\nreference to the current
row\r\n([#7994](https://github.com/elastic/eui/pull/7994))\r\n\r\n**CSS-in-JS
conversions**\r\n\r\n- Converted `EuiDataGrid`'s toolbar controls to
Emotion\r\n([#7997](https://github.com/elastic/eui/pull/7997))\r\n -
Removed `$euiDataGridPopoverMaxHeight`\r\n- Converted `EuiDataGrid` to
Emotion\r\n([#7998](https://github.com/elastic/eui/pull/7998))\r\n -
Removed `$euiZDataGrid`\r\n - Removed `$euiZHeaderBelowDataGrid`\r\n-
Converted `EuiDataGrid`'s `gridStyle`s to Emotion; Removed
the\r\nfollowing Sass variables and
mixins:\r\n([#8006](https://github.com/elastic/eui/pull/8006))\r\n -
`$euiDataGridCellPaddingS`\r\n - `$euiDataGridCellPaddingM`\r\n -
`$euiDataGridCellPaddingL`\r\n - `$euiDataGridVerticalBorder`\r\n -
`$euiDataGridPrefix`\r\n - `$euiDataGridStyles`\r\n -
`@euiDataGridSelector`\r\n - `@euiDataGridStyles`\r\n- Converted
`EuiDataGrid`'s cell popover, actions, and focus outline to\r\nEmotion;
Removed the following Sass variables and
mixins:\r\n([#8011](https://github.com/elastic/eui/pull/8011))\r\n -
`$euiZDataGridCellPopover`\r\n - `@euiDataGridCellFocus`\r\n- Converted
`EuiDataGrid`'s row, header, and footer cells to Emotion;\r\nRemoved the
following Sass variables and
mixins:\r\n([#8013](https://github.com/elastic/eui/pull/8013))\r\n -
`$euiDataGridColumnResizerWidth`\r\n - `@euiDataGridRowCell`\r\n -
`@euiDataGridHeaderCell`\r\n -
`@euiDataGridFooterCell`","sha":"9bbb296078ea385561d46819001644cdb4fdc714"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/192756","number":192756,"mergeCommit":{"message":"Upgrade
EUI to v95.11.0 (#192756)\n\n`v95.10.1`⏩`v95.11.0`\r\n\r\n> [!note]\r\n>
The bulk of this release is **EuiDataGrid**. The component has
been\r\nfully converted to Emotion, and several UX changes have been
made to\r\ndata cell actions. We recommend QA testing any data grid(s)
that have\r\ncustom styles applied to them.\r\n\r\n_[Questions? Please
see our Kibana
upgrade\r\nFAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_\r\n\r\n---\r\n\r\n##
[`v95.11.0`](https://github.com/elastic/eui/releases/v95.11.0)\r\n\r\n-
Updated `EuiText`, `EuiTextColor`, and `EuiTextAlign` with a
new\r\n`component` prop that allows changing the default rendered
`<div>`\r\nwrapper to a `<span>` or `<p>`
tag.\r\n([#7993](https://github.com/elastic/eui/pull/7993))\r\n- Updated
`EuiDataGrid`'s cell actions to always consistently be\r\nleft-aligned,
regardless of text content
alignment\r\n([#8011](https://github.com/elastic/eui/pull/8011))\r\n-
Increased `EuiDataGrid`'s cell actions hover zone to reduce
UX\r\nfriction when mousing over from the grid cell to its
actions\r\n([#8011](https://github.com/elastic/eui/pull/8011))\r\n\r\n**Bug
fixes**\r\n\r\n- Fixed `EuiPopover` to correctly inherit from
`EuiProvider`'s\r\n`componentDefaults.EuiPortal.insert`\r\n([#8003](https://github.com/elastic/eui/pull/8003))\r\n-
Fixed push `EuiFlyoutResizable`s to not potentially block
scrollbars\r\non outside content
([#8010](https://github.com/elastic/eui/pull/8010))\r\n- Fixed an
`EuiDataGrid` bug where the `setCellProps` callback passed
by\r\n`renderCellValue` was not correctly applying custom
`data-test-subj`s\r\n([#8011](https://github.com/elastic/eui/pull/8011))\r\n\r\n**Accessibility**\r\n\r\n-
Updated the `EuiBasicTable` actions button's `aria-label` by adding
a\r\nreference to the current
row\r\n([#7994](https://github.com/elastic/eui/pull/7994))\r\n\r\n**CSS-in-JS
conversions**\r\n\r\n- Converted `EuiDataGrid`'s toolbar controls to
Emotion\r\n([#7997](https://github.com/elastic/eui/pull/7997))\r\n -
Removed `$euiDataGridPopoverMaxHeight`\r\n- Converted `EuiDataGrid` to
Emotion\r\n([#7998](https://github.com/elastic/eui/pull/7998))\r\n -
Removed `$euiZDataGrid`\r\n - Removed `$euiZHeaderBelowDataGrid`\r\n-
Converted `EuiDataGrid`'s `gridStyle`s to Emotion; Removed
the\r\nfollowing Sass variables and
mixins:\r\n([#8006](https://github.com/elastic/eui/pull/8006))\r\n -
`$euiDataGridCellPaddingS`\r\n - `$euiDataGridCellPaddingM`\r\n -
`$euiDataGridCellPaddingL`\r\n - `$euiDataGridVerticalBorder`\r\n -
`$euiDataGridPrefix`\r\n - `$euiDataGridStyles`\r\n -
`@euiDataGridSelector`\r\n - `@euiDataGridStyles`\r\n- Converted
`EuiDataGrid`'s cell popover, actions, and focus outline to\r\nEmotion;
Removed the following Sass variables and
mixins:\r\n([#8011](https://github.com/elastic/eui/pull/8011))\r\n -
`$euiZDataGridCellPopover`\r\n - `@euiDataGridCellFocus`\r\n- Converted
`EuiDataGrid`'s row, header, and footer cells to Emotion;\r\nRemoved the
following Sass variables and
mixins:\r\n([#8013](https://github.com/elastic/eui/pull/8013))\r\n -
`$euiDataGridColumnResizerWidth`\r\n - `@euiDataGridRowCell`\r\n -
`@euiDataGridHeaderCell`\r\n -
`@euiDataGridFooterCell`","sha":"9bbb296078ea385561d46819001644cdb4fdc714"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>
Co-authored-by: Cee Chen <constance.chen@elastic.co>
  • Loading branch information
3 people authored Sep 27, 2024
1 parent 621b192 commit 6dfc890
Show file tree
Hide file tree
Showing 24 changed files with 114 additions and 164 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"@elastic/ecs": "^8.11.1",
"@elastic/elasticsearch": "^8.15.0",
"@elastic/ems-client": "8.5.3",
"@elastic/eui": "95.10.1",
"@elastic/eui": "95.11.0",
"@elastic/filesaver": "1.1.2",
"@elastic/node-crypto": "1.2.1",
"@elastic/numeral": "^2.5.1",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,18 @@ export const getEuiContextMapping = (): EuiTokensObject => {
description: 'ARIA label for a button that enters fullscreen view',
}
),
'euiCollapsedItemActions.allActions': i18n.translate(
'core.euiCollapsedItemActions.allActions',
'euiCollapsedItemActions.allActions': ({ index }: EuiValues) =>
i18n.translate('core.euiCollapsedItemActions.allActions', {
defaultMessage: 'All actions, row {index}',
values: { index },
description:
'ARIA label for a button that is rendered on multiple table rows, that expands an actions menu',
}),
'euiCollapsedItemActions.allActionsTooltip': i18n.translate(
'core.euiCollapsedItemActions.allActionsTooltip',
{
defaultMessage: 'All actions',
description:
'ARIA label and tooltip content describing a button that expands an actions menu',
description: 'Tooltip content describing a button that expands an actions menu',
}
),
'euiCollapsedItemActions.allActionsDisabled': i18n.translate(
Expand Down Expand Up @@ -251,6 +257,11 @@ export const getEuiContextMapping = (): EuiTokensObject => {
defaultMessage: 'Sort {schemaLabel}',
values: { schemaLabel },
}),
'euiColumnActions.unsort': ({ schemaLabel }: EuiValues) =>
i18n.translate('core.euiColumnActions.unsort', {
defaultMessage: 'Unsort {schemaLabel}',
values: { schemaLabel },
}),
'euiColumnActions.moveLeft': i18n.translate('core.euiColumnActions.moveLeft', {
defaultMessage: 'Move left',
}),
Expand Down Expand Up @@ -529,10 +540,10 @@ export const getEuiContextMapping = (): EuiTokensObject => {
values: { page, pageCount },
description: 'Screen reader text to describe the size of the data grid',
}),
'euiDataGridCell.position': ({ columnId, row, col }: EuiValues) =>
'euiDataGridCell.position': ({ columnName, columnIndex, rowIndex }: EuiValues) =>
i18n.translate('core.euiDataGridCell.position', {
defaultMessage: '{columnId}, column {col}, row {row}',
values: { columnId, row, col },
defaultMessage: '{columnName}, column {columnIndex}, row {rowIndex}',
values: { columnName, columnIndex, rowIndex },
}),
'euiDataGridCell.expansionEnterPrompt': i18n.translate(
'core.euiDataGridCell.expansionEnterPrompt',
Expand Down
33 changes: 9 additions & 24 deletions packages/kbn-unified-data-table/src/components/data_table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@
.euiDataGridHeaderCell {
align-items: start;

&:not(.euiDataGridHeaderCell--controlColumn) .euiDataGridHeaderCell__button {
height: 100%;
align-items: flex-start;
.euiPopover[class*='euiDataGridHeaderCell__popover'] {
align-self: center;
}
}

.euiDataGrid--headerUnderline .euiDataGridHeaderCell {
.euiDataGrid--bordersHorizontal .euiDataGridHeader {
border-top: none;
}

.euiDataGrid--headerUnderline .euiDataGridHeader {
border-bottom: $euiBorderThin;
}

Expand Down Expand Up @@ -93,7 +96,8 @@
}

.euiDataGridRowCell__content--autoHeight,
.euiDataGridRowCell__content--lineCountHeight {
.euiDataGridRowCell__content--lineCountHeight,
.euiDataGridHeaderCell__content {
white-space: pre-wrap;
}
}
Expand All @@ -104,25 +108,6 @@
min-height: 0;
}

// We only truncate if the cell is not a control column.
.euiDataGridHeader {

.euiDataGridHeaderCell__content {
white-space: pre-wrap;
}

.euiDataGridHeaderCell__popover {
flex-grow: 0;
flex-basis: auto;
width: auto;
padding-left: $euiSizeXS;
}
}

.euiDataGridRowCell--numeric {
text-align: right;
}

.euiDataGrid__loading,
.euiDataGrid__noResults {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion src/dev/license_checker/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const LICENSE_OVERRIDES = {
'jsts@1.6.2': ['Eclipse Distribution License - v 1.0'], // cf. https://github.com/bjornharrtell/jsts
'@mapbox/jsonlint-lines-primitives@2.0.2': ['MIT'], // license in readme https://github.com/tmcw/jsonlint
'@elastic/ems-client@8.5.3': ['Elastic License 2.0'],
'@elastic/eui@95.10.1': ['Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0'],
'@elastic/eui@95.11.0': ['Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0'],
'language-subtag-registry@0.3.21': ['CC-BY-4.0'], // retired ODC‑By license https://github.com/mattcg/language-subtag-registry
'buffers@0.1.1': ['MIT'], // license in importing module https://www.npmjs.com/package/binary
'@bufbuild/protobuf@1.2.1': ['Apache-2.0'], // license (Apache-2.0 AND BSD-3-Clause)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@
}

.kbnDocViewer__fieldsGrid {
&.euiDataGrid--noControls.euiDataGrid--bordersHorizontal .euiDataGridHeaderCell {
&.euiDataGrid--noControls.euiDataGrid--bordersHorizontal .euiDataGridHeader {
border-top: none;
}

&.euiDataGrid--headerUnderline .euiDataGridHeaderCell {
&.euiDataGrid--headerUnderline .euiDataGridHeader {
border-bottom: $euiBorderThin;
}

Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/discover/esql/_esql_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const cell = await dataGrid.getCellElementExcludingControlColumns(0, 1);
expect(await cell.getVisibleText()).to.be(' - ');
expect(await dataGrid.getHeaders()).to.eql([
'Select column',
"Select columnPress the Enter key to interact with this cell's contents.", // contains screen reader help text
'Control column',
'Access to degraded docs',
'Access to available stacktraces',
Expand Down
33 changes: 22 additions & 11 deletions test/functional/services/data_grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class DataGridService extends FtrService {
const table = await this.find.byCssSelector('.euiDataGrid');
const $ = await table.parseDomContent();

const columns = $('.euiDataGridHeaderCell__content')
const columns = $('.euiDataGridHeaderCell')
.toArray()
.map((cell) => $(cell).text());
const cells = $.findTestSubjects('dataGridRowCell')
Expand All @@ -59,7 +59,7 @@ export class DataGridService extends FtrService {
cellDataTestSubj: string
): Promise<string[][]> {
const $ = await element.parseDomContent();
const columnNumber = $('.euiDataGridHeaderCell__content').length;
const columnNumber = $('.euiDataGridHeaderCell').length;
const cells = $.findTestSubjects('dataGridRowCell')
.toArray()
.map((cell) =>
Expand All @@ -79,7 +79,7 @@ export class DataGridService extends FtrService {
public async getHeaders() {
const header = await this.testSubjects.find('euiDataGridBody > dataGridHeader');
const $ = await header.parseDomContent();
return $('.euiDataGridHeaderCell__content')
return $('.euiDataGridHeaderCell')
.toArray()
.map((cell) => $(cell).text());
}
Expand Down Expand Up @@ -134,6 +134,7 @@ export class DataGridService extends FtrService {
let actionButton: WebElementWrapper | undefined;
await this.retry.try(async () => {
const cell = await this.getCellElement(rowIndex, columnIndex);
await cell.moveMouseTo();
await cell.click();
actionButton = await cell.findByTestSubject(selector);
if (!actionButton) {
Expand All @@ -154,6 +155,7 @@ export class DataGridService extends FtrService {
columnIndex,
'euiDataGridCellExpandButton'
);
await actionButton.moveMouseTo();
await actionButton.click();
await this.retry.waitFor('popover to be opened', async () => {
return await this.testSubjects.exists('euiDataGridExpansionPopover');
Expand Down Expand Up @@ -197,6 +199,7 @@ export class DataGridService extends FtrService {
*/
public async clickCellFilterForButton(rowIndex: number = 0, columnIndex: number = 0) {
const actionButton = await this.getCellActionButton(rowIndex, columnIndex, 'filterForButton');
await actionButton.moveMouseTo();
await actionButton.click();
}

Expand All @@ -215,11 +218,13 @@ export class DataGridService extends FtrService {
controlsCount + columnIndex,
'filterForButton'
);
await actionButton.moveMouseTo();
await actionButton.click();
}

public async clickCellFilterOutButton(rowIndex: number = 0, columnIndex: number = 0) {
const actionButton = await this.getCellActionButton(rowIndex, columnIndex, 'filterOutButton');
await actionButton.moveMouseTo();
await actionButton.click();
}

Expand All @@ -233,6 +238,7 @@ export class DataGridService extends FtrService {
controlsCount + columnIndex,
'filterOutButton'
);
await actionButton.moveMouseTo();
await actionButton.click();
}

Expand Down Expand Up @@ -374,6 +380,7 @@ export class DataGridService extends FtrService {

if (toggle) {
await toggle.scrollIntoViewIfNecessary();
await toggle.moveMouseTo();
await toggle.click();
await this.retry.waitFor('doc viewer to open', async () => {
return this.isShowingDocViewer();
Expand Down Expand Up @@ -402,9 +409,7 @@ export class DataGridService extends FtrService {
}

public async getHeaderFields(): Promise<string[]> {
const result = await this.find.allByCssSelector(
'.euiDataGridHeaderCell:not(.euiDataGridHeaderCell--controlColumn) .euiDataGridHeaderCell__content'
);
const result = await this.find.allByCssSelector('.euiDataGridHeaderCell__content');

const textArr = [];
for (const cell of result) {
Expand All @@ -415,9 +420,7 @@ export class DataGridService extends FtrService {
}

public async getControlColumnHeaderFields(): Promise<string[]> {
const result = await this.find.allByCssSelector(
'.euiDataGridHeaderCell--controlColumn .euiDataGridHeaderCell__content'
);
const result = await this.find.allByCssSelector('.euiDataGridHeaderCell--controlColumn');

const textArr = [];
for (const cell of result) {
Expand Down Expand Up @@ -628,15 +631,20 @@ export class DataGridService extends FtrService {
const cellSelector = ['addFilterForValueButton', 'addFilterOutValueButton'].includes(actionName)
? `tableDocViewRow-${fieldName}-value`
: `tableDocViewRow-${fieldName}-name`;
await this.testSubjects.moveMouseTo(cellSelector);
await this.testSubjects.click(cellSelector);

await this.retry.waitFor('grid cell actions to appear', async () => {
return this.testSubjects.exists(`${actionName}-${fieldName}`);
});
}

public async clickFieldActionInFlyout(fieldName: string, actionName: string): Promise<void> {
await this.showFieldCellActionInFlyout(fieldName, actionName);
await this.testSubjects.click(`${actionName}-${fieldName}`);

const actionSelector = `${actionName}-${fieldName}`;
await this.testSubjects.moveMouseTo(actionSelector);
await this.testSubjects.click(actionSelector);
}

public async isFieldPinnedInFlyout(fieldName: string): Promise<boolean> {
Expand All @@ -658,11 +666,14 @@ export class DataGridService extends FtrService {
}

public async expandFieldNameCellInFlyout(fieldName: string): Promise<void> {
const cellSelector = `tableDocViewRow-${fieldName}-name`;
const buttonSelector = 'euiDataGridCellExpandButton';
await this.testSubjects.click(`tableDocViewRow-${fieldName}-name`);
await this.testSubjects.moveMouseTo(cellSelector);
await this.testSubjects.click(cellSelector);
await this.retry.waitFor('grid cell actions to appear', async () => {
return this.testSubjects.exists(buttonSelector);
});
await this.testSubjects.moveMouseTo(buttonSelector);
await this.testSubjects.click(buttonSelector);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ describe('DataTable', () => {
wrapper.update();
expect(
wrapper
.find('[data-test-subj="dataGridRowCell"]')
.find('div[data-test-subj="dataGridRowCell"]')
.at(0)
.find('.euiDataGridRowCell__content')
.find('div.euiDataGridRowCell__content')
.childAt(0)
.text()
).toEqual(mockTimelineData[0].ecs.timestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ describe('DatatableComponent', () => {
expect(screen.getByLabelText('My fanci metric chart')).toBeInTheDocument();
expect(screen.getByRole('row')).toBeInTheDocument();
expect(screen.queryAllByRole('gridcell').map((cell) => cell.textContent)).toEqual([
'shoes- a, column 1, row 1',
'1588024800000- b, column 2, row 1',
'3- c, column 3, row 1',
'shoes',
'1588024800000',
'3',
]);
});

Expand Down Expand Up @@ -352,8 +352,8 @@ describe('DatatableComponent', () => {
},
});
expect(screen.queryAllByRole('gridcell').map((cell) => cell.textContent)).toEqual([
'1588024800000- b, column 1, row 1',
'3- c, column 2, row 1',
'1588024800000',
'3',
]);
});

Expand Down Expand Up @@ -698,9 +698,9 @@ describe('DatatableComponent', () => {
.map((cell) => [cell.textContent, cell.style.backgroundColor]);

expect(cellColors).toEqual([
['shoes- a, column 1, row 1', 'red'],
['1588024800000- b, column 2, row 1', ''],
['3- c, column 3, row 1', ''],
['shoes', 'red'],
['1588024800000', ''],
['3', ''],
]);
});

Expand All @@ -717,9 +717,9 @@ describe('DatatableComponent', () => {
.map((cell) => [cell.textContent, cell.style.backgroundColor]);

expect(cellColors).toEqual([
['shoes- a, column 1, row 1', ''],
['1588024800000- b, column 2, row 1', ''],
['3- c, column 3, row 1', 'red'],
['shoes', ''],
['1588024800000', ''],
['3', 'red'],
]);
});
});
Expand Down
Loading

0 comments on commit 6dfc890

Please sign in to comment.