2023-03-14 13:18:55 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-03-14 13:18:55 +00:00
|
|
|
*/
|
|
|
|
|
2020-06-23 09:12:04 +00:00
|
|
|
export default (clickable, confirmation) => (actions, scope) => {
|
|
|
|
return actions.reduce(
|
|
|
|
(prev, item) => {
|
|
|
|
const itemScope = `[data-test-${item}-action]`;
|
|
|
|
return {
|
|
|
|
...prev,
|
|
|
|
[item]: clickable(`${itemScope} [role='menuitem']`),
|
|
|
|
[`confirm${item.charAt(0).toUpperCase()}${item.substr(1)}`]: clickable(
|
|
|
|
`${itemScope} [role='menu'] button`
|
|
|
|
),
|
|
|
|
};
|
|
|
|
},
|
|
|
|
{
|
|
|
|
actions: clickable('label'),
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|