Rename old directory for behaviours as "features" to better communicate new intent with new directory structure to organize code and tests around features instead of technicalities (#6033)

Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Iku-tursoandJanne Savolainen authored and GitHub committed 2022-08-16 15:09:08 +03:00
1 parent 36077a9fea
commit 299922c8a7
107 files changed

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -0,0 +1,148 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { RenderResult } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import platformInjectable from "../../common/vars/platform.injectable";
import { type ApplicationBuilder, getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
describe("Command Pallet: keyboard shortcut tests", () => {
let applicationBuilder: ApplicationBuilder;
let rendered: RenderResult;
beforeEach(async () => {
applicationBuilder = getApplicationBuilder();
});
describe("when on macOS", () => {
beforeEach(async () => {
applicationBuilder.dis.rendererDi.override(platformInjectable, () => "darwin");
rendered = await applicationBuilder.render();
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
it("does not show the command pallet yet", () => {
const actual = rendered.queryByTestId("command-container");
expect(actual).toBeNull();
});
describe("when pressing ESC", () => {
beforeEach(() => {
userEvent.keyboard("{Escape}");
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
it("does not show the command pallet yet", () => {
const actual = rendered.queryByTestId("command-container");
expect(actual).toBeNull();
});
});
describe("when pressing SHIFT+CMD+P", () => {
beforeEach(() => {
userEvent.keyboard("{Shift>}{Meta>}P{/Meta}{/Shift}");
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
it("shows the command pallet", () => {
const actual = rendered.queryByTestId("command-container");
expect(actual).toBeInTheDocument();
});
describe("when pressing ESC", () => {
beforeEach(() => {
userEvent.keyboard("{Escape}");
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
it("no longer shows the command pallet", () => {
const actual = rendered.queryByTestId("command-container");
expect(actual).toBeNull();
});
});
});
});
describe("when on linux", () => {
beforeEach(async () => {
applicationBuilder.dis.rendererDi.override(platformInjectable, () => "linux");
rendered = await applicationBuilder.render();
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
it("does not show the command pallet yet", () => {
const actual = rendered.queryByTestId("command-container");
expect(actual).toBeNull();
});
describe("when pressing ESC", () => {
beforeEach(() => {
userEvent.keyboard("{Escape}");
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
it("does not show the command pallet yet", () => {
const actual = rendered.queryByTestId("command-container");
expect(actual).toBeNull();
});
});
describe("when pressing SHIFT+CTRL+P", () => {
beforeEach(() => {
userEvent.keyboard("{Shift>}{Control>}P{/Control}{/Shift}");
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
it("shows the command pallet", () => {
const actual = rendered.queryByTestId("command-container");
expect(actual).toBeInTheDocument();
});
describe("when pressing ESC", () => {
beforeEach(() => {
userEvent.keyboard("{Escape}");
});
it("renders", () => {
expect(rendered.baseElement).toMatchSnapshot();
});
it("no longer shows the command pallet", () => {
const actual = rendered.queryByTestId("command-container");
expect(actual).toBeNull();
});
});
});
});
});