- Finish page starts Lutra through Explorer (Exec, returns at once) instead of RunAsUser/ShellExecute on the setup's UI thread. The 0.0.0 setup hung there while the new, unsigned exe was checked (Norton 360 active); Windows ended it and left lutra-desktop.exe suspended. The NSIS template is an adapted copy of tauri-bundler 2.10.2's. - installer/hooks.nsh registers Lutra only under OpenWithProgids and Applications\lutra-desktop.exe for .php/.phtml/.phpt/.inc; the default app stays. The uninstaller removes exactly those entries. macOS gets an Alternate-rank CFBundleDocumentTypes entry and handles RunEvent::Opened. - A file path argument opens the file inside its Git/Composer root (or folder); a running instance takes it over, switching projects only when the file lies outside (never over unsaved changes). - Version 0.1.0-alpha in the workspace, tauri.conf.json and ui; a test keeps tauri.conf.json in step with the crate version. - xtask bundle passes CARGO_TARGET_DIR to the Tauri CLI as an absolute path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
65 lines
2.6 KiB
TypeScript
65 lines
2.6 KiB
TypeScript
/**
|
|
* Tests for the root component: it loads product information on mount and
|
|
* shows it, or the error, in the status bar, and it wires the UI commands:
|
|
* `Mod+1` hides and shows the Project tool window, `Mod+Shift+P` opens the
|
|
* palette.
|
|
*/
|
|
import { flushPromises, mount } from "@vue/test-utils";
|
|
import { createPinia, setActivePinia } from "pinia";
|
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
const invoke = vi.hoisted(() => vi.fn());
|
|
vi.mock("@tauri-apps/api/core", () => ({ invoke }));
|
|
|
|
import App from "../src/App.vue";
|
|
|
|
describe("App", () => {
|
|
beforeEach(() => {
|
|
invoke.mockReset();
|
|
setActivePinia(createPinia());
|
|
});
|
|
|
|
it("shows name and version in the status bar", async () => {
|
|
invoke.mockImplementation((command: string) =>
|
|
Promise.resolve(
|
|
command === "engine_list_commands"
|
|
? []
|
|
: { name: "Lutra", version: "0.1.0-alpha", slogan: "An otterly perfect IDE" },
|
|
),
|
|
);
|
|
const wrapper = mount(App);
|
|
await flushPromises();
|
|
expect(wrapper.get("[data-test=status-bar]").text()).toBe("Lutra 0.1.0-alpha");
|
|
expect(wrapper.get("[data-test=main]").text()).toBe("An otterly perfect IDE");
|
|
});
|
|
|
|
it("shows the engine error when the call fails", async () => {
|
|
invoke.mockRejectedValue({ code: "internal", message: "engine unavailable" });
|
|
const wrapper = mount(App);
|
|
await flushPromises();
|
|
const bar = wrapper.get("[data-test=status-bar]");
|
|
expect(bar.text()).toBe("engine unavailable");
|
|
expect(bar.classes()).toContain("status-bar--error");
|
|
});
|
|
|
|
it("toggles the project tree and opens the palette from the keyboard", async () => {
|
|
invoke.mockImplementation((command: string) =>
|
|
Promise.resolve(command === "engine_list_commands" ? [] : null),
|
|
);
|
|
const wrapper = mount(App, { attachTo: document.body });
|
|
await flushPromises();
|
|
const press = async (init: KeyboardEventInit): Promise<void> => {
|
|
window.dispatchEvent(new KeyboardEvent("keydown", { bubbles: true, cancelable: true, ...init }));
|
|
await flushPromises();
|
|
};
|
|
expect(wrapper.find("[data-test=tool-window]").exists()).toBe(true);
|
|
await press({ key: "1", code: "Digit1", ctrlKey: true });
|
|
expect(wrapper.find("[data-test=tool-window]").exists()).toBe(false);
|
|
expect(wrapper.find("[data-test=left-stripe]").exists()).toBe(true);
|
|
await press({ key: "1", code: "Digit1", ctrlKey: true });
|
|
expect(wrapper.find("[data-test=tool-window]").exists()).toBe(true);
|
|
await press({ key: "P", code: "KeyP", ctrlKey: true, shiftKey: true });
|
|
expect(wrapper.find("[data-test=palette]").exists()).toBe(true);
|
|
wrapper.unmount();
|
|
});
|
|
});
|