mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Make component transient
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
1707a95eef
commit
667e90ba0e
@ -18,7 +18,7 @@ exports[`kube-object-menu given kube object renders 1`] = `
|
|||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
class="Icon material interactive focusable"
|
class="Icon material interactive focusable"
|
||||||
id="tooltip_target_4"
|
id="tooltip_target_6"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
@ -68,7 +68,7 @@ exports[`kube-object-menu given kube object when removing kube object renders 1`
|
|||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
class="Icon material interactive focusable"
|
class="Icon material interactive focusable"
|
||||||
id="tooltip_target_8"
|
id="tooltip_target_10"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
@ -171,7 +171,7 @@ exports[`kube-object-menu given kube object with namespace when removing kube ob
|
|||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
class="Icon material interactive focusable"
|
class="Icon material interactive focusable"
|
||||||
id="tooltip_target_33"
|
id="tooltip_target_35"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
@ -274,7 +274,7 @@ exports[`kube-object-menu given kube object without namespace when removing kube
|
|||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
class="Icon material interactive focusable"
|
class="Icon material interactive focusable"
|
||||||
id="tooltip_target_41"
|
id="tooltip_target_43"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
@ -369,3 +369,23 @@ exports[`kube-object-menu given no kube object, renders 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`kube-object-menu given rendered multiple times, renders separate instances 1`] = `
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<ul
|
||||||
|
class="Animate opacity Menu MenuActions flex KubeObjectMenu toolbar gaps right bottom"
|
||||||
|
style="--enter-duration: 100ms; --leave-duration: 100ms;"
|
||||||
|
/>
|
||||||
|
<ul
|
||||||
|
class="Animate opacity Menu MenuActions flex KubeObjectMenu toolbar gaps right bottom"
|
||||||
|
style="--enter-duration: 100ms; --leave-duration: 100ms;"
|
||||||
|
>
|
||||||
|
<li>
|
||||||
|
Some menu item
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
,
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
`;
|
||||||
|
|||||||
@ -28,7 +28,7 @@ import {
|
|||||||
} from "./kube-object-menu";
|
} from "./kube-object-menu";
|
||||||
|
|
||||||
import type { KubeObject } from "../../../common/k8s-api/kube-object";
|
import type { KubeObject } from "../../../common/k8s-api/kube-object";
|
||||||
import type { Injectable } from "@ogre-tools/injectable";
|
import { lifecycleEnum, Injectable } from "@ogre-tools/injectable";
|
||||||
import apiManagerInjectable from "./dependencies/apiManager.injectable";
|
import apiManagerInjectable from "./dependencies/apiManager.injectable";
|
||||||
import clusterNameInjectable from "./dependencies/clusterName.injectable";
|
import clusterNameInjectable from "./dependencies/clusterName.injectable";
|
||||||
import kubeObjectMenuRegistryInjectable from "./dependencies/kubeObjectMenuRegistry.injectable";
|
import kubeObjectMenuRegistryInjectable from "./dependencies/kubeObjectMenuRegistry.injectable";
|
||||||
@ -49,8 +49,10 @@ const KubeObjectMenuInjectable: Injectable<
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
instantiate: (dependencies, props) => (
|
instantiate: (dependencies, props) => (
|
||||||
<KubeObjectMenu<KubeObject> {...dependencies} {...props} />
|
<KubeObjectMenu {...dependencies} {...props} />
|
||||||
),
|
),
|
||||||
|
|
||||||
|
lifecycle: lifecycleEnum.transient,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default KubeObjectMenuInjectable;
|
export default KubeObjectMenuInjectable;
|
||||||
|
|||||||
@ -110,6 +110,36 @@ describe("kube-object-menu", () => {
|
|||||||
}).not.toThrow();
|
}).not.toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("given rendered multiple times, renders separate instances", () => {
|
||||||
|
di.override(clusterInjectable, null);
|
||||||
|
|
||||||
|
const { baseElement } = render(
|
||||||
|
<>
|
||||||
|
<Inject
|
||||||
|
injectableKey={KubeObjectMenuInjectable}
|
||||||
|
toolbar={true}
|
||||||
|
object={null} />
|
||||||
|
|
||||||
|
<Inject
|
||||||
|
injectableKey={KubeObjectMenuInjectable}
|
||||||
|
toolbar={true}
|
||||||
|
object={KubeObject.create({
|
||||||
|
apiVersion: "some-api-version",
|
||||||
|
kind: "some-kind",
|
||||||
|
metadata: {
|
||||||
|
uid: "some-uid",
|
||||||
|
name: "some-other-name",
|
||||||
|
resourceVersion: "some-resource-version",
|
||||||
|
namespace: "some-namespace",
|
||||||
|
},
|
||||||
|
})}
|
||||||
|
/>,
|
||||||
|
</>,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(baseElement).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
it("given no kube object, renders", () => {
|
it("given no kube object, renders", () => {
|
||||||
objectStub = null;
|
objectStub = null;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user