From 24b9b1219d8b0d973f712bf052f55ae2acdc8eaf Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Tue, 24 Sep 2019 10:14:13 -0600 Subject: [PATCH] Add data-test-subj support to non-custom table actions (#2353) * add data-test-subj support around non-custom actions * Add data-test-subj proptype to basic table action * Update data-test-subj prop documentation * changelog * Update src/components/basic_table/collapsed_item_actions.js Co-Authored-By: Caroline Horn <549577+cchaos@users.noreply.github.com> * Update snapshot * changelog --- CHANGELOG.md | 2 ++ src-docs/src/views/tables/actions/actions.js | 5 +++++ src-docs/src/views/tables/basic/props_info.js | 6 ++++++ .../__snapshots__/collapsed_item_actions.test.js.snap | 1 + src/components/basic_table/basic_table.js | 1 + src/components/basic_table/collapsed_item_actions.js | 2 ++ src/components/basic_table/default_item_action.js | 2 ++ 7 files changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3569c5ea32..034c3b6bb15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## [`master`](https://github.com/elastic/eui/tree/master) +- Added `data-test-subj` support for basic and in-memory tables' actions ([#2353](https://github.com/elastic/eui/pull/2353)) + **Bug fixes** - Fixed spacing of `EuiFormErrorText` to match `EuiFormHelpText` ([#2354](https://github.com/elastic/eui/pull/2354)) diff --git a/src-docs/src/views/tables/actions/actions.js b/src-docs/src/views/tables/actions/actions.js index 55552bf2845..c3d9340e912 100644 --- a/src-docs/src/views/tables/actions/actions.js +++ b/src-docs/src/views/tables/actions/actions.js @@ -163,6 +163,7 @@ export class Table extends Component { description: 'Clone this user', icon: 'copy', onClick: this.cloneUser, + 'data-test-subj': 'action-clone', }, { name: 'Delete', @@ -172,6 +173,7 @@ export class Table extends Component { type: 'icon', onClick: this.deleteUser, isPrimary: true, + 'data-test-subj': 'action-delete', }, { name: 'Edit', @@ -180,6 +182,7 @@ export class Table extends Component { icon: 'pencil', type: 'icon', onClick: () => {}, + 'data-test-subj': 'action-edit', }, { name: 'Share', @@ -188,6 +191,7 @@ export class Table extends Component { icon: 'share', type: 'icon', onClick: () => {}, + 'data-test-subj': 'action-share', }, ]; } else { @@ -212,6 +216,7 @@ export class Table extends Component { type: 'icon', href: 'https://elastic.co', target: '_blank', + 'data-test-subj': 'action-outboundlink', }, ]; } diff --git a/src-docs/src/views/tables/basic/props_info.js b/src-docs/src/views/tables/basic/props_info.js index 834274aaceb..0dc3d730f1b 100644 --- a/src-docs/src/views/tables/basic/props_info.js +++ b/src-docs/src/views/tables/basic/props_info.js @@ -404,6 +404,12 @@ export const propsInfo = { required: false, type: { name: 'string (must be one of the supported button colors)' }, }, + 'data-test-subj': { + description: + "Applies a data-test-subj attribute to the action's DOM node", + required: false, + type: { name: 'string' }, + }, }, }, }, diff --git a/src/components/basic_table/__snapshots__/collapsed_item_actions.test.js.snap b/src/components/basic_table/__snapshots__/collapsed_item_actions.test.js.snap index cba30915d37..c461186c7c1 100644 --- a/src/components/basic_table/__snapshots__/collapsed_item_actions.test.js.snap +++ b/src/components/basic_table/__snapshots__/collapsed_item_actions.test.js.snap @@ -14,6 +14,7 @@ exports[`CollapsedItemActions render 1`] = `