style: redesign PDF as full-page cyberpunk dashboard
CI and Deploy / test-build-deploy (push) Successful in 4s
CI and Deploy / test-build-deploy (push) Successful in 4s
This commit is contained in:
@@ -13,9 +13,9 @@ assert.ok(start >= 0 && end > start, 'PDF-Download-Implementierung fehlt');
|
||||
|
||||
const sandbox = { Uint8Array, TextEncoder, Blob };
|
||||
vm.createContext(sandbox);
|
||||
vm.runInContext(`${html.slice(start, end)}\nglobalThis.api={pdfFilename,buildPdfBytes};`, sandbox);
|
||||
vm.runInContext(`${html.slice(start, end)}\nglobalThis.api={pdfFilename,parsePdfRecipe,buildPdfBytes};`, sandbox);
|
||||
|
||||
const { pdfFilename, buildPdfBytes } = sandbox.api;
|
||||
const { pdfFilename, parsePdfRecipe, buildPdfBytes } = sandbox.api;
|
||||
assert.equal(
|
||||
pdfFilename('Napoletana', 4, 250, '24 Stunden'),
|
||||
'Pizzateig-Napoletana-4x250g-24-Stunden.pdf'
|
||||
@@ -29,7 +29,7 @@ assert.equal(
|
||||
'Pizzateig-Romisch-tonda-4x200g-Uber-Nacht.pdf'
|
||||
);
|
||||
|
||||
const bytes = buildPdfBytes([
|
||||
const recipeLines = [
|
||||
'PIZZATEIG — Napoletana',
|
||||
'4 Teiglinge à 250 g · 1.000 g Teig',
|
||||
'Mehl: Caputo Pizzeria · Hydration 62 %',
|
||||
@@ -48,7 +48,16 @@ const bytes = buildPdfBytes([
|
||||
' 19:00 Di — Pizza backen',
|
||||
'',
|
||||
'https://teig.deploybar.de/#style=napo&balls=4&ball=250&plan=d24',
|
||||
]);
|
||||
];
|
||||
const parsed = JSON.parse(JSON.stringify(parsePdfRecipe(recipeLines)));
|
||||
assert.equal(parsed.title, 'PIZZATEIG — Napoletana');
|
||||
assert.deepEqual(parsed.overview, ['4 Teiglinge à 250 g', '1.000 g Teig', 'Mehl: Caputo Pizzeria', 'Hydration 62 %']);
|
||||
assert.deepEqual(parsed.sections.map(section => section.title), ['ZUTATEN', 'ZEITPLAN']);
|
||||
assert.equal(parsed.sections[0].items.length, 4);
|
||||
assert.equal(parsed.sections[1].items.length, 5);
|
||||
assert.match(parsed.link, /^https:\/\/teig\.deploybar\.de\//);
|
||||
|
||||
const bytes = buildPdfBytes(recipeLines);
|
||||
assert.ok(bytes instanceof Uint8Array);
|
||||
const ascii = Buffer.from(bytes).toString('latin1');
|
||||
assert.ok(ascii.startsWith('%PDF-1.4'));
|
||||
|
||||
Reference in New Issue
Block a user