1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

try and fix test again

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-04-29 14:06:02 -04:00
parent 4fafcc19b6
commit fc57049b8f
2 changed files with 12 additions and 6 deletions

View File

@ -170,7 +170,7 @@ describe("kube-object-menu", () => {
it("renders", async () => {
await screen.findByTestId("confirmation-dialog");
expect(baseElement).toMatchSnapshot();
await waitFor(() => expect(baseElement).toMatchSnapshot());
});
describe("when remove is confirmed", () => {

View File

@ -134,17 +134,23 @@ class NonInjectedKubeObjectMenu<Kube extends KubeObject> extends React.Component
private renderContextMenuItems = (object: KubeObject) => (
[...this.menuItems]
.reverse() // This is done because the order that we "grow" is right->left
.map(({ icon, ...rest }) => ({
...rest,
icon: typeof icon === "string"
? { material: icon }
: icon,
}))
.map((item, index) => (
<MenuItem
key={`context-menu-item-${index}`}
onClick={() => item.onClick(object)}
data-testid={`menu-action-${item.title.toLowerCase().replace(/\s+/, "-")}`}
>
{
typeof item.icon === "string"
? <Icon material={item.icon} interactive={this.props.toolbar} tooltip={item.title} />
: <Icon {...item.icon} interactive={this.props.toolbar} tooltip={item.title} />
}
<Icon
{...item.icon}
interactive={this.props.toolbar}
tooltip={item.title}
/>
<span className="title">
{item.title}
</span>