Replace the sample data with synthetic fixtures and regenerate goldens and thumbnails
The template harness, tests and thumbnails now use a neutral vendor, bank account and a generated sample wordmark (scripts/logo/make-sample-logo.mjs). Layout goldens and the 14 picker thumbnails are regenerated. Fixture strings keep their original lengths where layout tests depend on them.
This commit is contained in:
@@ -157,7 +157,7 @@ describe("header", () => {
|
||||
|
||||
it("the vendor name stands in the empty left corner, level with the title, in Lustria caps", async () => {
|
||||
const r = await renderFixture(PLAIN, prefsFor("A4", { templateId: "marble" }));
|
||||
const name = items(r, "Sample P")[0];
|
||||
const name = items(r, "TEST VENDOR")[0];
|
||||
expect(name.bottom).toBeCloseTo(124.9, 0);
|
||||
expect(name.x0).toBeCloseTo(38.5, 0);
|
||||
});
|
||||
@@ -218,7 +218,7 @@ describe("logo", () => {
|
||||
it("without the opt-in no logo is drawn, even when the invoice has one", async () => {
|
||||
const r = await renderFixture({ name: "o", items: 2, logo: "real" }, prefsFor("A4", { templateId: "marble" }));
|
||||
expect(imageBoxes(r)).toHaveLength(0);
|
||||
expect(items(r, "Sample P")).toHaveLength(1);
|
||||
expect(items(r, "TEST VENDOR")).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("every opted-in logo fits the 150 x 50 slot, starts at the text inset and rests on its bottom edge", async () => {
|
||||
@@ -250,7 +250,7 @@ describe("logo", () => {
|
||||
});
|
||||
|
||||
it("a wordmark replaces the vendor name text; a mark keeps it under the mark", async () => {
|
||||
const header = (r: R) => r.pdf.pages[0].items.filter((i) => squash(i.str) === "SampleP" && i.bottom < 200);
|
||||
const header = (r: R) => r.pdf.pages[0].items.filter((i) => squash(i.str) === "TESTVENDOR" && i.bottom < 200);
|
||||
const wide = await renderFixture({ name: "o", items: 2, logo: "real" }, optIn());
|
||||
expect(header(wide)).toHaveLength(0);
|
||||
const square = await renderFixture({ name: "o", items: 2, logo: "square" }, optIn());
|
||||
@@ -416,7 +416,7 @@ describe("long text", () => {
|
||||
|
||||
it("the foot band's text stays inside the band whatever the address, and its two columns never overlap", async () => {
|
||||
for (const size of ["A4", "LETTER"] as const) {
|
||||
const r = await renderFixture({ name: "long", items: 3, vendor: { vendorAddress: Array.from({ length: 8 }, (_, i) => `Address line ${i + 1} of a very long Indian address with a locality name`).join("\n"), vendorEmail: "Sample.longsurname.voiceover.studio.bangalore@examplestudios-india.co.in", vendorName: "Supercalifragilisticexpialidocious-Pneumonoultramicroscopic-1234567890" } }, prefsFor(size, { templateId: "marble" }));
|
||||
const r = await renderFixture({ name: "long", items: 3, vendor: { vendorAddress: Array.from({ length: 8 }, (_, i) => `Address line ${i + 1} of a very long Indian address with a locality name`).join("\n"), vendorEmail: "anon.longsurname.voiceover.studio.bangalore@examplestudios-india.co.in", vendorName: "Supercalifragilisticexpialidocious-Pneumonoultramicroscopic-1234567890" } }, prefsFor(size, { templateId: "marble" }));
|
||||
const frame = frameForPrefs(r.prefs);
|
||||
const decorText = onPage(r, 0).filter((n) => n.decor && n.type === "text" && n.box.y > frame.page.height - V.bands.bottom);
|
||||
const lines = decorText.flatMap((n) => textLines(n));
|
||||
|
||||
Reference in New Issue
Block a user