Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
5 changes: 5 additions & 0 deletions src-docs/src/views/tables/actions/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -172,6 +173,7 @@ export class Table extends Component {
type: 'icon',
onClick: this.deleteUser,
isPrimary: true,
'data-test-subj': 'action-delete',
},
{
name: 'Edit',
Expand All @@ -180,6 +182,7 @@ export class Table extends Component {
icon: 'pencil',
type: 'icon',
onClick: () => {},
'data-test-subj': 'action-edit',
},
{
name: 'Share',
Expand All @@ -188,6 +191,7 @@ export class Table extends Component {
icon: 'share',
type: 'icon',
onClick: () => {},
'data-test-subj': 'action-share',
},
];
} else {
Expand All @@ -212,6 +216,7 @@ export class Table extends Component {
type: 'icon',
href: 'https://elastic.co',
target: '_blank',
'data-test-subj': 'action-outboundlink',
},
];
}
Expand Down
6 changes: 6 additions & 0 deletions src-docs/src/views/tables/basic/props_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ exports[`CollapsedItemActions render 1`] = `
<button
aria-label="All actions"
class="euiButtonIcon euiButtonIcon--text"
data-test-subj="euiCollapsedItemActionsButton"
type="button"
>
<svg
Expand Down
1 change: 1 addition & 0 deletions src/components/basic_table/basic_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const DefaultItemActionType = PropTypes.shape({
PropTypes.oneOf(BUTTON_ICON_COLORS),
PropTypes.func, // (item) => oneOf(ICON_BUTTON_COLORS)
]),
'data-test-subj': PropTypes.string,
});

const CustomItemActionType = PropTypes.shape({
Expand Down
2 changes: 2 additions & 0 deletions src/components/basic_table/collapsed_item_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class CollapsedItemActions extends Component {
key={key}
disabled={!enabled}
icon={action.icon}
data-test-subj={action['data-test-subj']}
onClick={this.onClickItem.bind(
null,
action.onClick.bind(null, item)
Expand All @@ -113,6 +114,7 @@ export class CollapsedItemActions extends Component {
isDisabled={allDisabled}
onClick={this.togglePopover.bind(this)}
onFocus={onFocus}
data-test-subj="euiCollapsedItemActionsButton"
/>
)}
</EuiI18n>
Expand Down
2 changes: 2 additions & 0 deletions src/components/basic_table/default_item_action.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class DefaultItemAction extends Component {
onClick={onClick}
href={action.href}
target={action.target}
data-test-subj={action['data-test-subj']}
/>
);
} else {
Expand All @@ -57,6 +58,7 @@ export class DefaultItemAction extends Component {
onClick={onClick}
href={action.href}
target={action.target}
data-test-subj={action['data-test-subj']}
flush="right">
{action.name}
</EuiButtonEmpty>
Expand Down