feat: edit in the Changes panel, git graph history, plan quota (v2.3.0)
- Changes panel: a working file opens in a CodeMirror editor with its diff inline (DiffEditor.tsx, @codemirror/merge, lazy-loaded); Changes folds the unchanged lines, Whole file shows them; side by side at 50/50 and full width; a Revert per block; original from HEAD or the branch's merge base (`mergeBase` on GET /git/changes?range=branch) - Every diff: green = line added whole, red = removed whole, blue = edited in place (--diff-mod) - History drawn as a commit graph (#58: `parents` on GET /git/log, --date-order; lib/commitGraph.ts) - Per-workspace never-stage list, drawn orange in the Files tree (--kept); closed Terminal rows past three deleted - Status bar plan quota for Claude (per account) and Codex (GET /api/pricing/quota, server/lib/quota.js); compact hover panel that stays open, Refresh button with a spinner - Settings → Appearance holds language, theme and pet; Ctrl+Shift+C copies; compact sidebar navigation and short session times
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @file Tests for the History commit-graph layout: a straight line, a branch
|
||||
* merged back, converging lanes and a parent beyond the loaded page.
|
||||
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
|
||||
*/
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { commitGraph } from "../commitGraph";
|
||||
|
||||
const c = (sha: string, ...parents: string[]) => ({ sha, parents });
|
||||
|
||||
describe("commitGraph", () => {
|
||||
it("draws a linear history in one column", () => {
|
||||
const { rows, width } = commitGraph([c("c", "b"), c("b", "a"), c("a")]);
|
||||
expect(width).toBe(1);
|
||||
expect(rows.map((r) => r.col)).toEqual([0, 0, 0]);
|
||||
// The tip has no line from above; the root none below.
|
||||
expect(rows[0]?.segs).toEqual([{ x1: 0, y1: 0.5, x2: 0, y2: 1, color: 0 }]);
|
||||
expect(rows[2]?.segs).toEqual([{ x1: 0, y1: 0, x2: 0, y2: 0.5, color: 0 }]);
|
||||
});
|
||||
|
||||
it("opens a lane for a merged branch and closes it at the fork point", () => {
|
||||
// m merge of b2 into a2
|
||||
// |\\
|
||||
// a2 b2
|
||||
// | b1
|
||||
// |/
|
||||
// a1
|
||||
const { rows, width } = commitGraph([
|
||||
c("m", "a2", "b2"),
|
||||
c("a2", "a1"),
|
||||
c("b2", "b1"),
|
||||
c("b1", "a1"),
|
||||
c("a1"),
|
||||
]);
|
||||
expect(width).toBe(2);
|
||||
expect(rows.map((r) => r.col)).toEqual([0, 0, 1, 1, 0]);
|
||||
expect(rows[0]?.segs).toContainEqual({ x1: 0, y1: 0.5, x2: 1, y2: 1, color: 1 });
|
||||
// b1's lane converges into a1's column.
|
||||
expect(rows[4]?.segs).toContainEqual({ x1: 1, y1: 0, x2: 0, y2: 0.5, color: 1 });
|
||||
expect(rows[1]?.color).toBe(rows[0]?.color);
|
||||
expect(rows[2]?.color).not.toBe(rows[0]?.color);
|
||||
});
|
||||
|
||||
it("keeps a lane running for a parent past the page", () => {
|
||||
const { rows } = commitGraph([c("b", "a")]);
|
||||
expect(rows[0]?.segs).toEqual([{ x1: 0, y1: 0.5, x2: 0, y2: 1, color: 0 }]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user