From 286d077f3e2754455e5afae213ae1b4e322337e9 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Thu, 4 Jun 2026 10:01:47 -0500 Subject: [PATCH] test: failing repro for stretch-sizing --- test/stretch-sizing.test.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/stretch-sizing.test.ts diff --git a/test/stretch-sizing.test.ts b/test/stretch-sizing.test.ts new file mode 100644 index 0000000..d76011e --- /dev/null +++ b/test/stretch-sizing.test.ts @@ -0,0 +1,30 @@ +import { describe, expect, it } from "./suite.ts"; +import { createTerm } from "../term.ts"; +import { close, fixed, open, text } from "../ops.ts"; + +describe("stretch sizing", () => { + it("stretch sizing fills the container cross axis", async () => { + let term = await createTerm({ width: 12, height: 5 }); + let r = term.render([ + open("root", { + layout: { width: fixed(12), height: fixed(5), direction: "ttb" }, + }), + // stretch() on the cross axis should expand the fit-content child to + // fill the container width; cast since the sizing type is proposed. + open("child", { + layout: { + // deno-lint-ignore no-explicit-any + width: { type: "stretch" } as any, + height: fixed(3), + }, + }), + text("X"), + close(), + close(), + ]); + + // pins: a stretch child grows to the container's cross-axis width (12), + // rather than the unstretched width it computes today + expect(r.info.get("child")!.bounds.width).toBe(12); + }); +}); -- 2.51.2