Download tests/layout-engine.test.mjs from jwcalendar/calendar-layout-engine: direct link, hf CLI and curl.
- Browser
- Download file 1.21 kB
-
https://huggingface.co/spaces/jwcalendar/calendar-layout-engine/resolve/main/tests/layout-engine.test.mjs
- Command line
-
hf download hf://spaces/jwcalendar/calendar-layout-engine/tests/layout-engine.test.mjs
-
curl -L -o layout-engine.test.mjs https://huggingface.co/spaces/jwcalendar/calendar-layout-engine/resolve/main/tests/layout-engine.test.mjs
1.21 kB
| import test from "node:test"; import assert from "node:assert/strict"; | |
| import { calculateLayout,makeLayoutCss,makeSvg } from "../src/layout-engine.js"; | |
| test("A4 portrait layout derives printable geometry",()=>{const s=calculateLayout({year:2027,month:4,weekStart:1,paper:"A4",orientation:"portrait",margin:12,headerHeight:18,cellPadding:3,isoWeekColumn:false,adjacentMonths:true});assert.equal(s.pageWidth,210);assert.equal(s.pageHeight,297);assert.equal(s.printableWidth,186);assert.equal(s.columns,7);assert.equal(s.rows,5);assert.ok(s.cellWidth>26);}); | |
| test("Letter landscape and ISO week column change geometry",()=>{const s=calculateLayout({year:2027,month:4,weekStart:0,paper:"Letter",orientation:"landscape",margin:10,headerHeight:20,cellPadding:4,isoWeekColumn:true,adjacentMonths:false});assert.equal(s.pageWidth,279.4);assert.equal(s.pageHeight,215.9);assert.equal(s.columns,8);assert.ok(s.cellWidth<33);}); | |
| test("exports use computed dimensions",()=>{const s=calculateLayout({year:2027,month:1,weekStart:0,paper:"A4",orientation:"landscape",margin:10,headerHeight:18,cellPadding:3,isoWeekColumn:false,adjacentMonths:true});assert.match(makeLayoutCss(s),/@page/);assert.match(makeSvg(s),/<svg/);}); | |