fix(status): full-width tables + better diagnosis
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { visibleWidth } from "./ansi.js";
|
||||
import { renderTable } from "./table.js";
|
||||
|
||||
describe("renderTable", () => {
|
||||
@@ -16,4 +17,19 @@ describe("renderTable", () => {
|
||||
expect(out).toContain("Dashboard");
|
||||
expect(out).toMatch(/│ Dashboard\s+│/);
|
||||
});
|
||||
|
||||
it("expands flex columns to fill available width", () => {
|
||||
const width = 60;
|
||||
const out = renderTable({
|
||||
width,
|
||||
columns: [
|
||||
{ key: "Item", header: "Item", minWidth: 10 },
|
||||
{ key: "Value", header: "Value", flex: true, minWidth: 24 },
|
||||
],
|
||||
rows: [{ Item: "OS", Value: "macos 26.2 (arm64)" }],
|
||||
});
|
||||
|
||||
const firstLine = out.trimEnd().split("\n")[0] ?? "";
|
||||
expect(visibleWidth(firstLine)).toBe(width);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user