mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-05 16:04:43 +00:00
The screen attached the pick side effects (remembering the isolation, syncing the picker's PR
attachment) as listeners in its own useEffect, which runs after a child item's mount effect. A
mount-time setIsolation("worktree") switched the screen but was not saved, and setBaseRef skipped
the attachment sync. The effects are now injected when the setup model is built, so a command and
a pick run the same code from the first render. Closing the picker stays in the picker's handler.
77 lines
2.6 KiB
TypeScript
77 lines
2.6 KiB
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" });
|
|
});
|
|
});
|
|
}
|
|
|
|
test("a branch chosen while Local applies once the user switches to a new worktree", async ({
|
|
page,
|
|
}) => {
|
|
test.setTimeout(180_000);
|
|
await withNewWorkspaceIssuesExample(page, { compact: false }, async (screen) => {
|
|
await screen.chooseIssue("PAS-101 Slow sidebar");
|
|
await screen.chooseWorktree();
|
|
const created = await screen.createWorkspace({ prompt: "" });
|
|
expect(created.branch).toBe("pas-101-slow-sidebar");
|
|
expect(created.metadata).toEqual({ "new-workspace-issues.issue": "PAS-101" });
|
|
});
|
|
});
|
|
|
|
test("a plugin's branch applies when the project has no default base to branch off", async ({
|
|
page,
|
|
}) => {
|
|
test.setTimeout(180_000);
|
|
await withNewWorkspaceIssuesExample(
|
|
page,
|
|
{ compact: false, detachedHead: true },
|
|
async (screen) => {
|
|
await screen.chooseWorktree();
|
|
await screen.chooseIssue("PAS-101 Slow sidebar");
|
|
const created = await screen.createWorkspace();
|
|
expect(created.branch).toBe("pas-101-slow-sidebar");
|
|
},
|
|
);
|
|
});
|
|
|
|
test("an isolation set from a mount effect is remembered like a pick", async ({ page }) => {
|
|
test.setTimeout(180_000);
|
|
await withNewWorkspaceIssuesExample(
|
|
page,
|
|
{ compact: false, setsOnMount: true },
|
|
async (screen) => {
|
|
await screen.expectIsolation("worktree");
|
|
await screen.reopenWithoutPlugin();
|
|
await screen.expectIsolation("worktree");
|
|
},
|
|
);
|
|
});
|
|
|
|
test("an item can set the branch and metadata from its mount effect", async ({ page }) => {
|
|
test.setTimeout(180_000);
|
|
await withNewWorkspaceIssuesExample(
|
|
page,
|
|
{ compact: false, setsOnMount: true },
|
|
async (screen) => {
|
|
await screen.expectIsolation("worktree");
|
|
const created = await screen.createWorkspace();
|
|
expect(created.branch).toBe("set-on-mount");
|
|
expect(created.metadata).toEqual({ "new-workspace-issues.issue": "ON-MOUNT" });
|
|
},
|
|
);
|
|
});
|