feat(results): gold, silver and bronze medals for the top three in PDF, printouts and result tables (1.73.0)

This commit is contained in:
larssand committed 2026-11-06 23:12:29 +01:00
1 parent 7c25f23ad0
commit 41043a990d
12 files changed
+72 -12

No files matched your search

+10
View File
@@ -20,3 +20,13 @@ test("a long name is shortened with … instead of running into the next column"
const pdf = buildStyledPdf({ ...base, sections: [{ title: "", headers: ["Pos", "Förare", ...Array.from({ length: 14 }, (_, i) => `R${i + 1}`)], rows: [["1", "A".repeat(120), ...Array.from({ length: 14 }, () => "(100)")]] }] });
assert.ok(pdf.includes(Buffer.from([0x85])), "ellipsis as a WinAnsi byte");
});
test("places 1-3 get gold, silver and bronze medals - in the app tables and drawn in the PDF", async () => {
const { medal } = await import("../src/medal.js");
assert.equal(medal(1), '<span class="medal medal-1">1</span>');
assert.equal(medal("3"), '<span class="medal medal-3">3</span>');
assert.equal(medal(4), "4");
const pdf = buildStyledPdf({ ...base, sections: [{ title: "", headers: ["Pos", "Förare"], rows: [["1", "A"], ["2", "B"], ["3", "C"], ["4", "D"]] }] }).toString("latin1");
assert.ok(pdf.includes("0.941 0.773 0.247 rg") && pdf.includes("0.812 0.835 0.863 rg") && pdf.includes("0.827 0.541 0.298 rg"), "gold, silver and bronze medal faces");
assert.ok(pdf.includes("(4) Tj"), "place 4 stays a plain number");
});