another text
-${thisTextShouldAppear}
`, - textExpectedInOutput: thisTextShouldAppear, - }, - ])(`with special text %j`, ({ name, text, textExpectedInOutput }) => { - // given - const storeWithSingleActivity = cloneDeep(activityWithSingleText) - storeWithSingleActivity['/content_node/single_texts/4300e3355d22'].data.html = text + const thisTextShouldAppear = 'this text should appear' + it.each([ + { + name: 'with_empty_lists', + text: `another text
+${thisTextShouldAppear}
`, + textExpectedInOutput: thisTextShouldAppear, + }, + ])(`with special text %j`, ({ name, text, textExpectedInOutput }) => { + // given + const storeWithSingleActivity = cloneDeep(activityWithSingleText) + storeWithSingleActivity['/content_node/single_texts/4300e3355d22'].data.html = + text - const store = wrap(storeWithSingleActivity) + const store = wrap(storeWithSingleActivity) - // when - const result = renderVueToPdfStructure(CampPrint, { - store, - $tc: tcMock, - locale: 'de', - config: { - language: 'de', - documentName: 'Morgenturnen.pdf', - options: { pageNumbers: false }, - camp: store.get(campIri), - contents: [ - { - type: 'Activity', - options: { - activity: activityIri, - scheduleEntry: scheduleEntryIri, - }, + // when + const result = renderVueToPdfStructure(CampPrint, { + store, + $tc: tcMock, + locale: 'de', + config: { + language: 'de', + documentName: 'Morgenturnen.pdf', + options: { pageNumbers: false, pageSize }, + camp: store.get(campIri), + contents: [ + { + type: 'Activity', + options: { + activity: activityIri, + scheduleEntry: scheduleEntryIri, + }, + }, + ], }, - ], - }, - }) + }) - // then - expect(result).toMatchFileSnapshot( - `./__snapshots__/single_activity_with_special_text_${name}.spec.json.snap` - ) + // then + expect(result).toMatchFileSnapshot( + `./__snapshots__/single_activity_with_special_text_${name}_${pageSize}.spec.json.snap` + ) - expect(JSON.stringify(result, createCircularReplacer())).toMatch(textExpectedInOutput) + expect(JSON.stringify(result, createCircularReplacer())).toMatch( + textExpectedInOutput + ) + }) + }) }) }) diff --git a/print/assets/print-preview.css b/print/assets/print-preview.css index 098968bd60..1106cc3c44 100644 --- a/print/assets/print-preview.css +++ b/print/assets/print-preview.css @@ -10,17 +10,36 @@ } .tw-break-after-page { - max-width: 794px; /* page width: A4 width of 210mm at 96dpi */ - min-height: 1123px; /* page height: A4 height of 297mm at 96dpi */ background-color: var(--color-paper); padding: 57px; /* page margin: 15mmm at 96dpi */ margin: 35px auto; } - .tw-break-after-page.landscape-page { + .a3.tw-break-after-page { + max-width: 1123px; /* page width: A3 width of 297mm at 96dpi */ + min-height: 1588px; /* page height: A3 height of 420mm at 96dpi */ + } + .a4.tw-break-after-page { + max-width: 794px; /* page width: A4 width of 210mm at 96dpi */ + min-height: 1123px; /* page height: A4 height of 297mm at 96dpi */ + } + .a5.tw-break-after-page { + max-width: 562px; /* page width: A5 width of 149mm at 96dpi */ + min-height: 794px; /* page height: A5 height of 210mm at 96dpi */ + } + + .a3.tw-break-after-page.landscape-page { + max-width: 1588px; /* page width: A3 landscape width of 420mm at 96dpi */ + min-height: 1123px; /* page height: A3 landscape height of 297mm at 96dpi */ + } + .a4.tw-break-after-page.landscape-page { max-width: 1123px; /* page width: A4 landscape width of 297mm at 96dpi */ min-height: 794px; /* page height: A4 landscape height of 210mm at 96dpi */ } + .a5.tw-break-after-page.landscape-page { + max-width: 794px; /* page width: A5 landscape width of 210mm at 96dpi */ + min-height: 562px; /* page height: A5 landscape height of 149mm at 96dpi */ + } .tw-break-after-page .tw-break-after-page { margin: 0; /* avoid margin stacking for nested `tw-break-after-page` */ diff --git a/print/components/PicassoChunk.vue b/print/components/PicassoChunk.vue index 5a40106d3a..4240c24a8d 100644 --- a/print/components/PicassoChunk.vue +++ b/print/components/PicassoChunk.vue @@ -1,6 +1,12 @@ -