[READ-ONLY] Mirror of https://github.com/bombshell-dev/tty. Platform independent 2D layout engine for terminal applications based on Clay
5

Configure Feed

Select the types of activity you want to include in your feed.

test(junction): add same-style and mixed single+double junction tests

Nate Moore (May 28, 2026, 12:54 AM EDT) c94cdf4f d415cc5c

+112
+112
test/term.test.ts
··· 187 187 expect(out).toMatch(/^┌─+┬/m); 188 188 }); 189 189 190 + it("renders T-junctions for a 2-column single-style grid", () => { 191 + let out = print( 192 + decode( 193 + term.render([ 194 + open("root", { 195 + layout: { width: grow(), height: grow(), direction: "ttb" }, 196 + border: { color: rgba(255, 255, 255), left: 1, right: 1, top: 1, bottom: 1 }, 197 + }), 198 + open("row", { layout: { width: grow(), height: grow(), direction: "ltr" } }), 199 + open("a", { 200 + layout: { width: fixed(10), height: grow() }, 201 + border: { color: rgba(255, 255, 255), right: 1 }, 202 + }), 203 + close(), 204 + open("b", { layout: { width: grow(), height: grow() } }), 205 + close(), 206 + close(), 207 + close(), 208 + ]).output, 209 + ), 210 + 40, 211 + 10, 212 + ); 213 + 214 + expect(out).toMatch(/^┌─+┬─+┐$/m); 215 + expect(out).toMatch(/^└─+┴─+┘$/m); 216 + expect(out).toMatch(/^│\s+│\s+│$/m); 217 + }); 218 + 219 + it("renders T-junctions for bold-style borders", () => { 220 + let out = print( 221 + decode( 222 + term.render([ 223 + open("root", { 224 + layout: { width: grow(), height: grow(), direction: "ltr" }, 225 + border: { color: rgba(255, 255, 255), left: 1, right: 1, top: 1, bottom: 1, style: "bold" }, 226 + }), 227 + open("left", { 228 + layout: { width: fixed(10), height: grow() }, 229 + border: { color: rgba(255, 255, 255), right: 1, style: "bold" }, 230 + }), 231 + close(), 232 + open("right", { layout: { width: grow(), height: grow() } }), 233 + close(), 234 + close(), 235 + ]).output, 236 + ), 237 + 40, 238 + 10, 239 + ); 240 + 241 + expect(out).toMatch(/^┏━+┳━+┓$/m); 242 + expect(out).toMatch(/^┗━+┻━+┛$/m); 243 + expect(out).toMatch(/^┃\s+┃\s+┃$/m); 244 + }); 245 + 246 + it("renders T-junctions for double-style borders", () => { 247 + let out = print( 248 + decode( 249 + term.render([ 250 + open("root", { 251 + layout: { width: grow(), height: grow(), direction: "ltr" }, 252 + border: { color: rgba(255, 255, 255), left: 1, right: 1, top: 1, bottom: 1, style: "double" }, 253 + }), 254 + open("left", { 255 + layout: { width: fixed(10), height: grow() }, 256 + border: { color: rgba(255, 255, 255), right: 1, style: "double" }, 257 + }), 258 + close(), 259 + open("right", { layout: { width: grow(), height: grow() } }), 260 + close(), 261 + close(), 262 + ]).output, 263 + ), 264 + 40, 265 + 10, 266 + ); 267 + 268 + expect(out).toMatch(/^╔═+╦═+╗$/m); 269 + expect(out).toMatch(/^╚═+╩═+╝$/m); 270 + expect(out).toMatch(/^║\s+║\s+║$/m); 271 + }); 272 + 273 + it("renders mixed single+double T-junction", () => { 274 + let out = print( 275 + decode( 276 + term.render([ 277 + open("root", { 278 + layout: { width: grow(), height: grow(), direction: "ltr" }, 279 + border: { color: rgba(255, 255, 255), left: 1, right: 1, top: 1, bottom: 1, style: "double" }, 280 + }), 281 + open("left", { 282 + layout: { width: fixed(10), height: grow() }, 283 + border: { color: rgba(255, 255, 255), right: 1, style: "single" }, 284 + }), 285 + close(), 286 + open("right", { layout: { width: grow(), height: grow() } }), 287 + close(), 288 + close(), 289 + ]).output, 290 + ), 291 + 40, 292 + 10, 293 + ); 294 + 295 + // double-H outer top/bottom meets single-V inner separator → ╤ / ╧ 296 + expect(out).toMatch(/^╔═+╤═+╗$/m); 297 + expect(out).toMatch(/^╚═+╧═+╝$/m); 298 + // interior: double verticals on sides, single in middle 299 + expect(out).toMatch(/^║\s+│\s+║$/m); 300 + }); 301 + 190 302 describe("line mode", () => { 191 303 let box = (msg: string) => [ 192 304 open("root", {