feat(live): rendered visualizer across entire container width
- Removed max width cap of 120 columns in LiveVisualizer. - Added unit test to verify full width rendering for wider viewports.
This commit is contained in:
@@ -138,7 +138,7 @@ export class LiveVisualizer implements Component {
|
||||
}
|
||||
|
||||
#renderLines(maxWidth: number): readonly string[] {
|
||||
const width = Math.max(2, Math.min(maxWidth, 120));
|
||||
const width = Math.max(2, maxWidth);
|
||||
const innerWidth = width - 2;
|
||||
const border = (content: string): string =>
|
||||
theme.fg("border", "│") + content + (width > 1 ? theme.fg("border", "│") : "");
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import { beforeAll, describe, expect, it } from "bun:test";
|
||||
import { visibleWidth } from "@oh-my-pi/pi-tui";
|
||||
import { LiveVisualizer } from "../src/live/visualizer";
|
||||
import { initTheme } from "../src/modes/theme/theme";
|
||||
|
||||
describe("LiveVisualizer", () => {
|
||||
beforeAll(async () => {
|
||||
await initTheme(false);
|
||||
});
|
||||
|
||||
it("renders across the entire provided width even when wider than 120 columns", () => {
|
||||
const visualizer = new LiveVisualizer({
|
||||
onStop: () => {},
|
||||
onToggleMute: () => {},
|
||||
});
|
||||
|
||||
for (const targetWidth of [80, 140, 200]) {
|
||||
const lines = visualizer.render(targetWidth);
|
||||
expect(lines.length).toBeGreaterThan(0);
|
||||
for (const line of lines) {
|
||||
expect(visibleWidth(line)).toBe(targetWidth);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user