mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-05 07:54:38 +00:00
addNewWorkspaceItem mounts a plugin field on the New workspace screen, and useNewWorkspace() exposes host, project, isolation, base ref, branch and metadata with commands that follow the composer item rules: they act on the screen's state when they run, resolve once applied, reject while the screen is locked, and take JSON payloads. Host and project are read-only because a command that switched them would unmount the item that called it. The screen's pickable state (base selection, manual isolation, branch, metadata) moves into one plain store so pickers and plugin commands write to the same place; the screen reports derived facts to it on each render. The branch is sent as source.branchName only for a branch-off worktree, and metadata on workspace.create. Items render through ComposerControl with a new "field" surface (badge on desktop, full-width field when compact). Combobox ships here: Paseo owns the loading and error states, keeps previous results, and drops superseded searches.
21 lines
807 B
TypeScript
21 lines
807 B
TypeScript
import { expect, test } from "../support/fixtures";
|
|
import { withNewWorkspaceIssuesExample } from "../support/helpers/plugin-new-workspace-items";
|
|
|
|
for (const layout of [
|
|
{ name: "desktop", compact: false },
|
|
{ name: "compact", compact: true },
|
|
]) {
|
|
test(`a plugin's New workspace item sets the branch and metadata on ${layout.name}`, async ({
|
|
page,
|
|
}) => {
|
|
test.setTimeout(180_000);
|
|
await withNewWorkspaceIssuesExample(page, { compact: layout.compact }, async (screen) => {
|
|
await screen.chooseWorktree();
|
|
await screen.chooseIssue("PAS-102 Crash on resume");
|
|
const created = await screen.createWorkspace();
|
|
expect(created.branch).toBe("pas-102-crash-on-resume");
|
|
expect(created.metadata).toEqual({ "new-workspace-issues.issue": "PAS-102" });
|
|
});
|
|
});
|
|
}
|