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 () => { it("renders", async () => {
await screen.findByTestId("confirmation-dialog"); await screen.findByTestId("confirmation-dialog");
expect(baseElement).toMatchSnapshot(); await waitFor(() => expect(baseElement).toMatchSnapshot());
}); });
describe("when remove is confirmed", () => { describe("when remove is confirmed", () => {

View File

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