From 6e380184f09cfd3c107f42b1ea8eb054fa23dfea Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Fri, 5 Jun 2026 21:22:30 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5tighten=20up=20the=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just testing text attributes, shouldn't need an enclosing box. --- test/default-foreground.test.ts | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/test/default-foreground.test.ts b/test/default-foreground.test.ts index 428310e..1a51593 100644 --- a/test/default-foreground.test.ts +++ b/test/default-foreground.test.ts @@ -1,22 +1,15 @@ -import { describe, expect, it } from "./suite.ts"; +import { text } from "../ops.ts"; import { createTerm } from "../term.ts"; -import { close, grow, open, text } from "../ops.ts"; +import { describe, expect, it } from "./suite.ts"; const decode = (b: Uint8Array) => new TextDecoder().decode(b); describe("true default foreground", () => { - it("uncolored text emits no concrete foreground", async () => { + it("emits uncolored text with no concrete foreground", async () => { let term = await createTerm({ width: 12, height: 1 }); - let ansi = decode( - term.render([ - open("root", { layout: { width: grow(), height: grow() } }), - text("hi"), - close(), - ]).output, - ); + let ansi = decode(term.render([text("hi")]).output); - let before = ansi.slice(0, ansi.indexOf("h")); - // pins: color-less text must leave the terminal default fg, not force white - expect(before).not.toContain("\x1b[38;2;255;255;255"); + expect(ansi).toContain("hi"); + expect(ansi).not.toContain("\x1b[38;2;255;255;255"); }); }); -- 2.51.2