дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 10:07:11 +02:00
Build Project / Build Module skipped Maven when no input changed, even after the modules' target/classes were deleted outside the IDE (mvn clean in a terminal). The up-to-date record now also lists the output folders that existed after the build, and a build is skipped only while they all still exist. The "Always show the main menu" toggle duplicated Main menu › Merged with main toolbar, showed on macOS where it does nothing, and kept the titles in a title bar too narrow for them. It is replaced by a third Main menu choice, Separate toolbar: the menu titles get their own row below the title bar and never collapse into the hamburger button.
48 рядки
2.4 KiB
TypeScript
48 рядки
2.4 KiB
TypeScript
import { act, fireEvent, render, screen } from "@testing-library/react";
|
|
import { afterEach, describe, expect, it } from "vitest";
|
|
import { usePlatform } from "@/platform/platformInfo";
|
|
import { validateAppearanceExtras } from "../model/behaviorSchema";
|
|
import { useSettingsDialog } from "../model/staging";
|
|
import { BEHAVIOR_PAGES } from "../pages/behavior";
|
|
|
|
const savedPlatform = usePlatform.getState();
|
|
const savedDialog = useSettingsDialog.getState();
|
|
afterEach(() => {
|
|
usePlatform.setState(savedPlatform);
|
|
useSettingsDialog.setState(savedDialog);
|
|
});
|
|
const option = BEHAVIOR_PAGES.find((p) => p.id === "appearance")!
|
|
.sections!.find((s) => s.title === "UI Options")!
|
|
.options.find((o) => o.kind === "custom")!;
|
|
if (option.kind !== "custom") throw new Error("UI Options missing");
|
|
const MainMenuStyleRow = option.component;
|
|
|
|
describe("Main menu appearance setting", () => {
|
|
it.each(["windows", "linux"])("offers both styles on a frameless %s title bar", async (os) => {
|
|
usePlatform.setState({ os, framelessTitleBar: true });
|
|
render(<MainMenuStyleRow />);
|
|
const select = screen.getByRole("button", { name: "Main menu" });
|
|
expect(select).toHaveTextContent("Hamburger button");
|
|
fireEvent.click(select);
|
|
fireEvent.click(await screen.findByRole("option", { name: "Merged with main toolbar" }));
|
|
expect(select).toHaveTextContent("Merged with main toolbar");
|
|
expect(useSettingsDialog.getState().staged["global|appearance.mainMenuStyle"]?.value).toBe("merged");
|
|
});
|
|
|
|
it.each(["macos", "web", "linux"])("hides the setting without the frameless menu (%s)", (os) => {
|
|
usePlatform.setState({ os, framelessTitleBar: false });
|
|
render(<MainMenuStyleRow />);
|
|
expect(screen.queryByText("Main menu")).toBeNull();
|
|
expect(screen.queryByRole("button", { name: "Main menu" })).toBeNull();
|
|
act(() => usePlatform.setState({ os: "windows", framelessTitleBar: true }));
|
|
expect(screen.getByRole("button", { name: "Main menu" })).toBeInTheDocument();
|
|
});
|
|
|
|
it("preserves the hamburger default for existing or invalid settings", () => {
|
|
expect(validateAppearanceExtras({}).mainMenuStyle).toBe("hamburger");
|
|
expect(validateAppearanceExtras({ mainMenuStyle: "unknown" }).mainMenuStyle).toBe("hamburger");
|
|
expect(validateAppearanceExtras({ mainMenuStyle: "merged" }).mainMenuStyle).toBe("merged");
|
|
expect(validateAppearanceExtras({ mainMenuStyle: "toolbar" }).mainMenuStyle).toBe("toolbar");
|
|
});
|
|
});
|