Harden task state and terminal rendering
This commit is contained in:
@@ -109,6 +109,18 @@ test("collapses completed widget subtrees while keeping list trees expanded", ()
|
||||
assert.ok(reopened.some((line) => line.includes("Done two")));
|
||||
});
|
||||
|
||||
test("caps the widget at twelve task rows with an overflow summary", () => {
|
||||
const state = new TaskState(() => 0);
|
||||
state.add(Array.from({ length: 20 }, (_, index) => ({ name: `Task ${index + 1}` })));
|
||||
|
||||
const lines = renderWidgetTree(state.list(), plainTheme as never, 60).map(stripAnsi);
|
||||
assert.equal(lines.length, 13);
|
||||
assert.match(lines[0] ?? "", /Task 1/);
|
||||
assert.match(lines[11] ?? "", /Task 12/);
|
||||
assert.equal(lines[12], " … 8 more tasks");
|
||||
assert.ok(lines.every((line) => visibleWidth(line) <= 60));
|
||||
});
|
||||
|
||||
test("hides a completed widget summary before squeezing the task name", () => {
|
||||
const state = new TaskState(() => 0);
|
||||
state.add([{ name: "A long parent task name", children: [{ name: "Done", status: "done" }] }]);
|
||||
|
||||
Reference in New Issue
Block a user