@@ -322,13 +322,10 @@ test.each([50, 80, 160])( |
322 | 322 | const header = viewer.app.renderer.root.findDescendantById("diff-source-header")! |
323 | 323 | const source = viewer.app.renderer.root.findDescendantById("diff-source-switch")! |
324 | 324 | const count = viewer.app.renderer.root.findDescendantById("diff-review-count")! |
325 | | - // Without the file tree, the header has one row of padding above and below its title. |
326 | | - const padded = width < 100 |
327 | | - expect(header.height).toBe(padded ? 3 : 1) |
328 | | - const title = header.y + (padded ? 1 : 0) |
329 | | - expect(source.y).toBe(title) |
330 | | - expect(count.y).toBe(title) |
331 | | - expect(viewer.app.captureCharFrame().split("\n")[title]).toMatch(/All · vs release\s+0\/1/) |
| 325 | + expect(header.height).toBe(1) |
| 326 | + expect(source.y).toBe(header.y) |
| 327 | + expect(count.y).toBe(header.y) |
| 328 | + expect(viewer.app.captureCharFrame().split("\n")[header.y]).toMatch(/All · vs release\s+0\/1/) |
332 | 329 | expect(viewer.app.captureCharFrame()).not.toContain("reviewed") |
333 | 330 | expect(viewer.vcsDiffInput()).toMatchObject({ base: "refs/remotes/origin/release" }) |
334 | 331 | await viewer.app.mockMouse.click(source.x, source.y) |
@@ -348,7 +345,7 @@ test.each([50, 80, 160])( |
348 | 345 | await viewer.app.waitForFrame((frame) => !frame.includes("Diff source")) |
349 | 346 | viewer.commands.get("diff.mark_reviewed")!.run() |
350 | 347 | await viewer.app.flush() |
351 | | - expect(viewer.app.captureCharFrame().split("\n")[title]).toMatch(/All · vs release\s+1\/1/) |
| 348 | + expect(viewer.app.captureCharFrame().split("\n")[header.y]).toMatch(/All · vs release\s+1\/1/) |
352 | 349 | await chooseSource(viewer, 2) |
353 | 350 | await viewer.app.waitForFrame((frame) => frame.includes("Uncommitted · vs HEAD")) |
354 | 351 | viewer.app.mockInput.pressKey("d") |
@@ -373,20 +370,18 @@ test.each([50, 80, 100, 160])( |
373 | 370 | try { |
374 | 371 | const header = viewer.app.renderer.root.findDescendantById("diff-source-header")! |
375 | 372 | const count = viewer.app.renderer.root.findDescendantById("diff-review-count")! |
376 | | - const padded = width < 100 |
377 | | - const title = header.y + (padded ? 1 : 0) |
378 | | - const row = viewer.app.captureCharFrame().split("\n")[title] |
379 | | - expect(header.height).toBe(padded ? 3 : 1) |
| 373 | + const row = viewer.app.captureCharFrame().split("\n")[header.y] |
| 374 | + expect(header.height).toBe(1) |
380 | 375 | expect(row).toContain("Committed · vs") |
381 | 376 | expect(row).toContain("0/1") |
382 | 377 | expect(row).not.toContain("release/very-long-comparison-branch-name-that-does-not-fit-in-the-header") |
383 | | - expect(count.y).toBe(title) |
| 378 | + expect(count.y).toBe(header.y) |
384 | 379 | expect(count.x + count.width).toBeLessThanOrEqual(header.x + header.width) |
385 | 380 | const hint = viewer.app.renderer.root.findDescendantById("diff-help-shortcut")! |
386 | 381 | if (width < 90) { |
387 | | - expect(hint.y).toBe(title) |
| 382 | + expect(hint.y).toBe(header.y) |
388 | 383 | expect(hint.x).toBeGreaterThan(count.x + count.width) |
389 | | - expect(findScrollBox(viewer.app.renderer.root)!.viewport.y).toBeGreaterThan(header.y + header.height - 1) |
| 384 | + expect(findScrollBox(viewer.app.renderer.root)!.viewport.y).toBeGreaterThan(header.y) |
390 | 385 | } |
391 | 386 | } finally { |
392 | 387 | viewer.app.renderer.destroy() |
@@ -1042,7 +1037,7 @@ test.each([100, 160])("shared pane edges align headings and stay fixed at %i col |
1042 | 1037 | await viewer.app.flush() |
1043 | 1038 | expect(viewer.app.renderer.root.findDescendantById("diff-tree-top-edge")).toBeUndefined() |
1044 | 1039 | expect(viewer.app.renderer.root.findDescendantById("diff-patch-top-edge")).toBeDefined() |
1045 | | - expect(viewer.app.captureCharFrame().split("\n")[title + 3]).toContain("file01.txt") |
| 1040 | + expect(viewer.app.captureCharFrame().split("\n")[title + 1]).toContain("file01.txt") |
1046 | 1041 | } finally { |
1047 | 1042 | viewer.app.renderer.destroy() |
1048 | 1043 | } |
@@ -1167,9 +1162,9 @@ test("compact gutter help leaves the full patch viewport available when the side |
1167 | 1162 | await viewer.app.flush() |
1168 | 1163 | const scroll = findScrollBox(viewer.app.renderer.root)! |
1169 | 1164 | const hint = viewer.app.renderer.root.findDescendantById("diff-help-shortcut")! |
1170 | | - expect(hint.y).toBe(1) |
| 1165 | + expect(hint.y).toBe(0) |
1171 | 1166 | expect(hint.x).toBe(159) |
1172 | | - expect(scroll.viewport.y).toBe(4) |
| 1167 | + expect(scroll.viewport.y).toBe(2) |
1173 | 1168 | expect(scroll.viewport.y + scroll.viewport.height).toBe(24) |
1174 | 1169 | await viewer.app.mockMouse.click(hint.x, hint.y) |
1175 | 1170 | await viewer.app.waitForFrame((frame) => frame.includes("Diff shortcuts")) |
@@ -1182,11 +1177,11 @@ test("compact gutter help leaves the full patch viewport available when the side |
1182 | 1177 | expect(viewer.app.renderer.root.findDescendantById("diff-help-shortcut")!.y).toBe(21) |
1183 | 1178 | viewer.app.resize(80, 24) |
1184 | 1179 | await viewer.app.flush() |
1185 | | - expect(viewer.app.renderer.root.findDescendantById("diff-help-shortcut")!.y).toBe(1) |
| 1180 | + expect(viewer.app.renderer.root.findDescendantById("diff-help-shortcut")!.y).toBe(0) |
1186 | 1181 | expect(viewer.app.renderer.root.findDescendantById("diff-help-shortcut")!.x).toBe(79) |
1187 | 1182 | expect(scroll.viewport.y + scroll.viewport.height).toBe(24) |
1188 | 1183 | expect(viewer.app.captureCharFrame()).not.toContain("? help") |
1189 | | - expect(viewer.app.captureCharFrame().split("\n")[1].at(-1)).toBe("?") |
| 1184 | + expect(viewer.app.captureCharFrame().split("\n")[0].at(-1)).toBe("?") |
1190 | 1185 | viewer.app.mockInput.pressKey("d") |
1191 | 1186 | await viewer.app.waitForFrame((frame) => frame.includes("Diff source")) |
1192 | 1187 | viewer.app.mockInput.pressEscape() |
|