Indent deepest task leaves

This commit is contained in:
jb
2026-08-27 00:46:54 -04:00
parent fbe8baf18c
commit 9c500a485c
3 changed files with 49 additions and 12 deletions
+12 -8
View File
@@ -62,7 +62,7 @@ test("renders lightweight connectors without a detached root continuation", () =
assert.deepEqual(output, [
" ◉ 1. Build auth · 00:00",
" ├─ ! 2. Resolve token issue",
" │ └─ ○ 3. Inspect provider response",
" │ └─ ○ 3. Inspect provider response",
" └─ ○ 4. Add middleware",
" ✓ 5. ~Define schema~",
]);
@@ -95,7 +95,7 @@ test("collapses completed widget subtrees while keeping list trees expanded", ()
" ├─ I. ○ Release",
" │ ├─ 1. ○ Completed branch · 2/2 done",
" │ └─ 2. ○ Open branch",
" │ └─ ○ Open leaf",
" │ └─ ○ Open leaf",
" └─ II. ○ Pending parent · 1/1 done",
]);
@@ -124,9 +124,9 @@ test("uses only the outline levels needed while leaving leaf tasks unlabeled", (
]);
assert.deepEqual(renderWidgetTree(twoLevelState.list(), plainTheme as never, 80).map(stripAnsi), [
" ├─ 1. ○ First group",
" │ └─ ○ First nested leaf",
" │ └─ ○ First nested leaf",
" └─ 2. ○ Second group",
" └─ ○ Second nested leaf",
" └─ ○ Second nested leaf",
]);
const state = new TaskState(() => 0);
@@ -151,7 +151,7 @@ test("uses only the outline levels needed while leaving leaf tasks unlabeled", (
" ├─ III. ○ Category three",
" ├─ IV. ○ Category four",
" │ ├─ 1. ○ First item",
" │ │ └─ ○ Leaf sub-item",
" │ │ └─ ○ Leaf sub-item",
" │ └─ 2. ○ Second item",
" └─ V. ○ Category five",
" └─ 1. ○ Reset item numbering",
@@ -164,6 +164,10 @@ test("uses only the outline levels needed while leaving leaf tasks unlabeled", (
assert.match(statusPriority[3] ?? "", /○/);
const childStatusPriority = renderWidgetTree(state.list(), plainTheme as never, 10).map(stripAnsi);
assert.match(childStatusPriority[4] ?? "", /○/);
const leafStatusPriority = renderWidgetTree(state.list(), plainTheme as never, 12).map(stripAnsi);
assert.match(leafStatusPriority[5] ?? "", /○/);
const listLeafStatusPriority = renderTree(state.list(), plainTheme as never, 12).map(stripAnsi);
assert.match(listLeafStatusPriority[5] ?? "", /○/);
const timedState = new TaskState(() => 0);
timedState.add([
@@ -214,10 +218,10 @@ test("renumbers widget labels after task reordering and reparenting", () => {
const lines = renderWidgetTree(state.list(), plainTheme as never, 80).map(stripAnsi);
assert.deepEqual(lines, [
" ├─ 1. ○ Category B",
" │ ├─ ○ A2",
" │ └─ ○ B1",
" │ ├─ ○ A2",
" │ └─ ○ B1",
" └─ 2. ○ Category A",
" └─ ○ A1",
" └─ ○ A1",
]);
});