mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Replace static application window with ability to create many (#5979)
* Replace static application window with ability to create as many as you wish Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Adapt tests for replacing static application window with ability to create as many as you wish and separate starting of main and window in behaviours Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Make first render of application smaller in test that proves to be hard for CI Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Remove redundant code Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> * Simplify code Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
1 parent
299922c8a7
commit
63d5a34379
98 files changed
+3283
-2743
No files matched your search
@@ -2,30 +2,27 @@
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { FakeExtensionData, TestExtension } from "../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import { getRendererExtensionFakeFor } from "../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import React from "react";
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import currentPathInjectable from "../renderer/routes/current-path.injectable";
|
||||
import type { ApplicationBuilder } from "../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../renderer/components/test-utils/get-application-builder";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import type { FakeExtensionOptions } from "../renderer/components/test-utils/get-extension-fake";
|
||||
|
||||
describe("extension special characters in page registrations", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
let builder: ApplicationBuilder;
|
||||
let rendered: RenderResult;
|
||||
let testExtension: TestExtension;
|
||||
let windowDi: DiContainer;
|
||||
|
||||
beforeEach(async () => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
|
||||
builder = getApplicationBuilder();
|
||||
|
||||
testExtension = getRendererExtensionFake(
|
||||
extensionWithPagesHavingSpecialCharacters,
|
||||
);
|
||||
rendered = await builder.render();
|
||||
|
||||
applicationBuilder.extensions.renderer.enable(testExtension);
|
||||
builder.extensions.enable(extensionWithPagesHavingSpecialCharacters);
|
||||
|
||||
rendered = await applicationBuilder.render();
|
||||
windowDi = builder.applicationWindow.only.di;
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
@@ -34,6 +31,9 @@ describe("extension special characters in page registrations", () => {
|
||||
|
||||
describe("when navigating to route with ID having special characters", () => {
|
||||
beforeEach(() => {
|
||||
const testExtension =
|
||||
builder.extensions.get("some-extension-id").applicationWindows.only;
|
||||
|
||||
testExtension.navigate("/some-page-id/");
|
||||
});
|
||||
|
||||
@@ -42,22 +42,25 @@ describe("extension special characters in page registrations", () => {
|
||||
});
|
||||
|
||||
it("knows URL", () => {
|
||||
const currentPath = applicationBuilder.dis.rendererDi.inject(currentPathInjectable);
|
||||
const currentPath = windowDi.inject(currentPathInjectable);
|
||||
|
||||
expect(currentPath.get()).toBe("/extension/some-extension-name--/some-page-id");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const extensionWithPagesHavingSpecialCharacters: FakeExtensionData = {
|
||||
const extensionWithPagesHavingSpecialCharacters: FakeExtensionOptions = {
|
||||
id: "some-extension-id",
|
||||
name: "@some-extension-name/",
|
||||
globalPages: [
|
||||
{
|
||||
id: "/some-page-id/",
|
||||
components: {
|
||||
Page: () => <div>Some page</div>,
|
||||
|
||||
rendererOptions: {
|
||||
globalPages: [
|
||||
{
|
||||
id: "/some-page-id/",
|
||||
components: {
|
||||
Page: () => <div>Some page</div>,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user