mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 20:45:33 -08:00
Make the git board's next-step Commit button commit the ticked files
AI Assisted
This commit is contained in:
1 parent
cc02631ab5
commit
9583b68a2e
3 files changed
+65
-18
No files matched your search
@@ -470,7 +470,35 @@ test("git board view: each step's click goes out as the board offers it", () =>
|
||||
const [branch, onMain] = stepButtons(main);
|
||||
click(branch);
|
||||
click(onMain);
|
||||
assert.deepEqual(main.on.calls, [["openPanel", "create", { commit: true }], ["openPanel", "commit"]]);
|
||||
const mainFiles = [...commitTicks(STATES["nb-main-dirty"].git.changes)];
|
||||
assert.deepEqual(main.on.calls, [["openPanel", "create", { commit: true }], ["send", "commit", { files: mainFiles, ignore: [] }]]);
|
||||
|
||||
// The commit table is always on show below the step, so the step's Commit
|
||||
// sends what the table has ticked rather than "opening" a panel already open.
|
||||
const dirty = draw("cp-dirty", { tab: "changes" });
|
||||
const ticked = [...commitTicks(STATES["cp-dirty"].git.changes)];
|
||||
const top = stepButtons(dirty).find((c) => c.textContent.startsWith("Commit "));
|
||||
assert.equal(top.textContent, `Commit ${ticked.length} file${ticked.length === 1 ? "" : "s"}`);
|
||||
click(top);
|
||||
assert.deepEqual(dirty.on.calls, [["send", "commit", { files: ticked, ignore: [] }]]);
|
||||
|
||||
const unticked = draw("cp-dirty", { tab: "changes" });
|
||||
unticked.board.ticks.clear();
|
||||
const redrawn = drawGitBoard({
|
||||
git: STATES["cp-dirty"].git, board: unticked.board, now: NOW, mode: "idle", step: unticked.step,
|
||||
badges: tabBadges(STATES["cp-dirty"].git, { now: NOW, stepTab: unticked.step.tab }), notice: null, activity: null, hasCard: false, h: fakeH(), on: fakeOn(),
|
||||
});
|
||||
const none = controls(walk(redrawn.node).find((n) => n.classes.has("git-step"))).find((c) => c.textContent.startsWith("Commit "));
|
||||
assert.ok(none.disabled, "nothing ticked: the step's Commit is grayed, like the table's");
|
||||
|
||||
const one = draw("cp-dirty", { tab: "changes" });
|
||||
one.board.ticks = new Set([ticked[0]]);
|
||||
const again = drawGitBoard({
|
||||
git: STATES["cp-dirty"].git, board: one.board, now: NOW, mode: "idle", step: one.step,
|
||||
badges: tabBadges(STATES["cp-dirty"].git, { now: NOW, stepTab: one.step.tab }), notice: null, activity: null, hasCard: false, h: fakeH(), on: fakeOn(),
|
||||
});
|
||||
const card = walk(again.node).find((n) => n.classes.has("git-step"));
|
||||
assert.equal(walk(card).find((n) => n.classes.has("git-step-title")).textContent, "Commit 1 file", "the card's title follows the ticks too");
|
||||
|
||||
const away = draw("pc-conflict", { tab: "changes" });
|
||||
click(walk(away.node).find((n) => n.classes.has("git-hint")));
|
||||
@@ -576,7 +604,7 @@ test("git board view: a landed result splits the step strip into Just landed and
|
||||
assert.ok(!walk(r.node).some((n) => n.classes.has("git-result")), "no thin result line beside the zones");
|
||||
const commit = controls(rest).find((c) => c.textContent === "Commit other changes");
|
||||
click(commit);
|
||||
assert.deepEqual(r.on.calls[0], ["openPanel", "commit"], "the leftover offer runs the same op the primary would");
|
||||
assert.deepEqual(r.on.calls[0], ["send", "commit", { files: [...commitTicks(STATES["cp-dirty"].git.changes)], ignore: [] }], "the leftover offer runs the same op the primary would");
|
||||
|
||||
const plain = landed("cp-dirty", { id: "git-result", kind: "notice", title: "Committed 1eef797", body: "no op marker" });
|
||||
assert.ok(walk(plain.node).some((n) => n.classes.has("git-result")), "a notice with no op keeps the thin line");
|
||||
|
||||
@@ -137,15 +137,14 @@ const settles = (control, enabled) => until(async () => (await control.isEnabled
|
||||
const settlesUsable = (page, want) => until(async () => (await usable(page)) === want, 8000);
|
||||
const titled = (page, text) => page.waitForFunction((x) => document.getElementById("title").textContent.includes(x), text);
|
||||
|
||||
test("the commit dialog sends the ticked files as one __git action, with its reply sentence", async (t) => {
|
||||
test("the next step's Commit sends the files ticked in the table as one __git action, with its reply sentence", async (t) => {
|
||||
const s = await openSession(await suite.browser(), { t, workflow: "git", project: changesProject({ branch: "feature/x" }), payload: READY });
|
||||
const { page } = s;
|
||||
await page.getByRole("tablist").waitFor();
|
||||
await stepButton(page, "Commit 2 files").click();
|
||||
const panel = page.locator(".git-panel");
|
||||
await panel.getByRole("button", { name: "Close" }).waitFor();
|
||||
await stepButton(page, "Commit 2 files").waitFor();
|
||||
await tickBox(page, "notes.md").uncheck();
|
||||
await panel.getByRole("button", { name: "Commit 1 file" }).click();
|
||||
// The table is already on show below, so the step's button commits rather than opening it.
|
||||
await stepButton(page, "Commit 1 file").click();
|
||||
const got = s.wait(10);
|
||||
assert.equal(got.code, 0, "the agent collected the click");
|
||||
assert.deepEqual(got.actions, [{ i: "__git", type: "git", op: "commit", files: ["src/app.js"], ignore: [] }]);
|
||||
@@ -261,7 +260,7 @@ test("a commit with no branch to land on carries the ticked files into the new b
|
||||
await tickBox(page, "notes.md").uncheck();
|
||||
// The step is on the Branches tab, and its Commit button finds no branch to commit on.
|
||||
await tabButton(page, "Branches").click();
|
||||
await stepButton(page, "Commit 2 files").click();
|
||||
await stepButton(page, "Commit 1 file").click();
|
||||
const panel = page.locator(".git-panel");
|
||||
await panel.getByRole("heading", { name: "New branch for this commit" }).waitFor();
|
||||
const create = panel.getByRole("button", { name: "Create", exact: true });
|
||||
|
||||
Reference in new issue
Block a user