Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data-test-subj support to non-custom table actions #2353

Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ No public interface changes since `14.2.0`.
- Added missing `compressed` TS definitions to `EuiComboBox`, `EuiCheckboxGroup`, `EuiCheckbox`, `EuiFieldSearch`, `EuiRadioGroup`, `EuiSwitch` ([#2338](https://github.com/elastic/eui/pull/2338))
- Added auto-margin between `EuiFormRow` and `EuiButton` ([#2338](https://github.com/elastic/eui/pull/2338))
- Added border to `[readOnly]` inputs ([#2338](https://github.com/elastic/eui/pull/2338))
- Added `data-test-subj` support for basic and in-memory tables' actions ([#2353](https://github.com/elastic/eui/pull/2353))

**Bug fixes**

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="euiCollapsedItemActions"
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="euiCollapsedItemActions"
chandlerprall marked this conversation as resolved.
Show resolved Hide resolved
/>
)}
</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