// No rail of one or two items (operator, 20 Nov: "the fact there's a one item timeline looks bad. Don't do that."): // the deck's pip track, the stacked deck's rail and the finale's large rail are not drawn under RAIL_MIN_PIPS -- // their markup there, hidden, nothing else moved -- and at or over it the page is the one it always was. // // Run with: pnpm test:scripts import assert from "node:assert/strict"; import test from "node:test"; import { finaleRegions } from "./build-video.mjs"; import { deckHtml } from "./chrome-deck.mjs"; import { finaleHtml } from "./chrome-finale.mjs"; import { stackedDeckHtml } from "./chrome-vdeck.mjs"; import { deckSchedule, RAIL_MIN_PIPS, railDrawn, railOffStyle } from "./deck.mjs"; import { verticalRender } from "./vertical.mjs"; const PALETTE = { bg: "#101219", fg: "#f2f0ea", muted: "#979caa", accent: "#e5534b", amber: "#ffc860" }; const render = (deck = {}) => ({ width: 1920, height: 1080, fps: 30, transition: 0.5, palette: PALETTE, chrome: { engine: "hyperframes", layout: "deck", deck } }); const clips = (n, extra = {}) => Array.from({ length: n }, (_, i) => ({ id: `c${i}`, type: "clip", video: `v${i}`, start: 100, end: 130, title: `T${i}`, ...(extra[i] ?? {}) })); const sched = (n, r) => deckSchedule({ entries: clips(n), durs: Array(n).fill(30), D: 0.5, render: r, provenance: {}, metas: Array(n).fill(null) }); test("the rule: three pips or more draw a rail; one or two none", () => { assert.equal(RAIL_MIN_PIPS, 3); assert.deepEqual([1, 2, 3, 4].map(railDrawn), [false, false, true, true]); assert.equal(railOffStyle(3), "", "drawn: no attribute at all, the markup as it was"); assert.equal(railOffStyle(2), ' style="display:none"'); }); test("the deck: 1 and 2 pips, its track hidden (pips, marker, fuse, flags with it); 3, the track as it always was", () => { const r = render(); for (const n of [1, 2]) assert.match(deckHtml(sched(n, r), r), /