mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Revert "chore: Convert sidebarItemInjectionToken to use InjectWithMetadata instead of duplicating the IDs"
This reverts commit 81293304a7.
This commit is contained in:
1 parent
9276df0592
commit
93bc41f9a3
62 files changed
+212
-145
No files matched your search
+4
-4
@@ -37,7 +37,7 @@ describe("disable sidebar items when cluster is not relevant", () => {
|
||||
|
||||
clusterPageMenus: [
|
||||
{
|
||||
id: "sidebar-item-some",
|
||||
id: "some-sidebar-item",
|
||||
title: "Some sidebar item",
|
||||
|
||||
components: {
|
||||
@@ -60,7 +60,7 @@ describe("disable sidebar items when cluster is not relevant", () => {
|
||||
|
||||
it("does not show the sidebar item", () => {
|
||||
const actual = rendered.queryByTestId(
|
||||
"sidebar-item-sidebar-item-some-extension-name-some",
|
||||
"sidebar-item-some-extension-name-some-sidebar-item",
|
||||
);
|
||||
|
||||
expect(actual).not.toBeInTheDocument();
|
||||
@@ -78,7 +78,7 @@ describe("disable sidebar items when cluster is not relevant", () => {
|
||||
|
||||
it("does not show the sidebar item", () => {
|
||||
const actual = rendered.queryByTestId(
|
||||
"sidebar-item-sidebar-item-some-extension-name-some",
|
||||
"sidebar-item-some-extension-name-some-sidebar-item",
|
||||
);
|
||||
|
||||
expect(actual).not.toBeInTheDocument();
|
||||
@@ -96,7 +96,7 @@ describe("disable sidebar items when cluster is not relevant", () => {
|
||||
|
||||
it("shows the sidebar item", () => {
|
||||
const actual = rendered.getByTestId(
|
||||
"sidebar-item-sidebar-item-test-extension-some",
|
||||
"sidebar-item-test-extension-some-sidebar-item",
|
||||
);
|
||||
|
||||
expect(actual).toBeInTheDocument();
|
||||
|
||||
@@ -85,8 +85,9 @@ describe("cluster - order of sidebar items", () => {
|
||||
});
|
||||
|
||||
const someParentSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-parent",
|
||||
id: "some-parent-sidebar-item",
|
||||
instantiate: () => ({
|
||||
id: "some-parent-id",
|
||||
parentId: null,
|
||||
title: "Some parent",
|
||||
onClick: noop,
|
||||
@@ -96,8 +97,9 @@ const someParentSidebarItemInjectable = getInjectable({
|
||||
});
|
||||
|
||||
const someOtherParentSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-other-parent",
|
||||
id: "some-other-parent-sidebar-item",
|
||||
instantiate: () => ({
|
||||
id: "some-other-parent-id",
|
||||
parentId: null,
|
||||
title: "Some other parent",
|
||||
onClick: noop,
|
||||
@@ -107,8 +109,9 @@ const someOtherParentSidebarItemInjectable = getInjectable({
|
||||
});
|
||||
|
||||
const someAnotherParentSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-another-parent",
|
||||
id: "some-another-parent-sidebar-item",
|
||||
instantiate: () => ({
|
||||
id: "some-another-parent-id",
|
||||
parentId: null,
|
||||
title: "Some another parent",
|
||||
onClick: noop,
|
||||
@@ -118,9 +121,10 @@ const someAnotherParentSidebarItemInjectable = getInjectable({
|
||||
});
|
||||
|
||||
const someChildSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-child",
|
||||
instantiate: () => ({
|
||||
parentId: someParentSidebarItemInjectable.id,
|
||||
id: "some-child-sidebar-item",
|
||||
instantiate: (di) => ({
|
||||
id: "some-child-id",
|
||||
parentId: di.inject(someParentSidebarItemInjectable).id,
|
||||
title: "Some child",
|
||||
onClick: noop,
|
||||
orderNumber: 168,
|
||||
@@ -129,9 +133,10 @@ const someChildSidebarItemInjectable = getInjectable({
|
||||
});
|
||||
|
||||
const someOtherChildSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-other-child",
|
||||
instantiate: () => ({
|
||||
parentId: someParentSidebarItemInjectable.id,
|
||||
id: "some-other-child-sidebar-item",
|
||||
instantiate: (di) => ({
|
||||
id: "some-other-child-id",
|
||||
parentId: di.inject(someParentSidebarItemInjectable).id,
|
||||
title: "Some other child",
|
||||
onClick: noop,
|
||||
orderNumber: 252,
|
||||
@@ -140,9 +145,10 @@ const someOtherChildSidebarItemInjectable = getInjectable({
|
||||
});
|
||||
|
||||
const someAnotherChildSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-another-child",
|
||||
instantiate: () => ({
|
||||
parentId: someParentSidebarItemInjectable.id,
|
||||
id: "some-another-child-sidebar-item",
|
||||
instantiate: (di) => ({
|
||||
id: "some-another-child-id",
|
||||
parentId: di.inject(someParentSidebarItemInjectable).id,
|
||||
title: "Some another child",
|
||||
onClick: noop,
|
||||
orderNumber: 210,
|
||||
|
||||
@@ -295,8 +295,9 @@ describe("cluster - sidebar and tab navigation for core", () => {
|
||||
});
|
||||
|
||||
const someParentSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-parent",
|
||||
id: "some-parent-sidebar-item",
|
||||
instantiate: () => ({
|
||||
id: "some-parent-id",
|
||||
parentId: null,
|
||||
title: "Some parent",
|
||||
onClick: noop,
|
||||
@@ -307,14 +308,15 @@ const someParentSidebarItemInjectable = getInjectable({
|
||||
});
|
||||
|
||||
const someChildSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-some-child",
|
||||
id: "some-child-sidebar-item",
|
||||
instantiate: (di) => {
|
||||
const route = di.inject(testRouteInjectable);
|
||||
const navigateToRoute = di.inject(navigateToRouteInjectionToken);
|
||||
const routeIsActive = di.inject(routeIsActiveInjectable, route);
|
||||
|
||||
return {
|
||||
parentId: someParentSidebarItemInjectable.id,
|
||||
id: "some-child-id",
|
||||
parentId: di.inject(someParentSidebarItemInjectable).id,
|
||||
title: "Some child",
|
||||
onClick: () => navigateToRoute(route),
|
||||
isActive: routeIsActive,
|
||||
|
||||
@@ -27,7 +27,7 @@ describe("cluster - visibility of sidebar items", () => {
|
||||
runInAction(() => {
|
||||
windowDi.register(testRouteInjectable);
|
||||
windowDi.register(testRouteComponentInjectable);
|
||||
windowDi.register(testSidebarItemInjectable);
|
||||
windowDi.register(testSidebarItemsInjectable);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -94,14 +94,15 @@ const testRouteComponentInjectable = getInjectable({
|
||||
injectionToken: routeSpecificComponentInjectionToken,
|
||||
});
|
||||
|
||||
const testSidebarItemInjectable = getInjectable({
|
||||
id: "sidebar-item-test",
|
||||
const testSidebarItemsInjectable = getInjectable({
|
||||
id: "some-sidebar-item-injectable",
|
||||
|
||||
instantiate: (di) => {
|
||||
const testRoute = di.inject(testRouteInjectable);
|
||||
const navigateToRoute = di.inject(navigateToRouteInjectionToken);
|
||||
|
||||
return {
|
||||
id: "some-item-id",
|
||||
parentId: null,
|
||||
title: "Some item",
|
||||
onClick: () => navigateToRoute(testRoute),
|
||||
|
||||
Reference in new issue
Block a user