Commit 6fc10433 authored by Guillaume's avatar Guillaume

resolves #215 do not force a page break on named page

parent 58b2c9ea
<!DOCTYPE html>
<html lang="en">
<head>
<title>named-page</title>
<meta charset="UTF-8">
<script src="../../../dist/paged.polyfill.js"></script>
<style>
#toc {
page: tableofcontents;
}
</style>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<header>
<div id="toc"><h1>Table of Contents</h1></div>
</header>
</body>
</html>
const TIMEOUT = 10000;
describe("no-forced-page-break", () => {
let page;
beforeAll(async () => {
page = await loadPage("named-page/no-forced-page-break/no-forced-page-break.html");
return page.rendered;
}, TIMEOUT);
afterAll(async () => {
if (!DEBUG) {
await page.close();
}
});
it("should not force a page break and render only 1 page", async () => {
let pages = await page.$$eval(".pagedjs_page", (r) => {
return r.length;
});
expect(pages).toEqual(1);
});
if (!DEBUG) {
it("should create a pdf", async () => {
let pdf = await page.pdf(PDF_SETTINGS);
expect(pdf).toMatchPDFSnapshot(1);
});
}
}
);
......@@ -285,7 +285,7 @@ export function needsPreviousBreakAfter(node) {
export function needsPageBreak(node) {
if( typeof node !== "undefined" &&
typeof node.dataset !== "undefined" &&
(node.dataset.page || node.dataset.afterPage)
node.dataset.afterPage
) {
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment