1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 21:20:09 +00:00

fix(status): keep compact header single-line on tight widths

This commit is contained in:
tw93
2026-02-27 10:07:44 +08:00
parent f4118dc883
commit bbe3d3f284
2 changed files with 53 additions and 13 deletions

View File

@@ -982,6 +982,34 @@ func TestRenderHeaderHidesOSAndUptimeOnNarrowWidth(t *testing.T) {
}
}
func TestRenderHeaderDropsLowPriorityInfoToStaySingleLine(t *testing.T) {
m := MetricsSnapshot{
HealthScore: 90,
Hardware: HardwareInfo{
Model: "MacBook Pro",
CPUModel: "Apple M2 Pro",
TotalRAM: "32.0 GB",
DiskSize: "460.4 GB",
RefreshRate: "60Hz",
OSVersion: "macOS 26.3",
},
GPU: []GPUStatus{{CoreCount: 19}},
Uptime: "9d 13h",
}
header, _ := renderHeader(m, "", 0, 100, true)
plain := stripANSI(header)
if strings.Contains(plain, "\n") {
t.Fatalf("renderHeader() should stay single line when trimming low-priority fields, got %q", plain)
}
if strings.Contains(plain, "macOS 26.3") {
t.Fatalf("renderHeader() should drop os version when width is tight, got %q", plain)
}
if strings.Contains(plain, "up 9d 13h") {
t.Fatalf("renderHeader() should drop uptime when width is tight, got %q", plain)
}
}
func TestRenderCardWrapsOnNarrowWidth(t *testing.T) {
card := cardData{
icon: iconCPU,