Commit e13d1952 authored by Fred Chasen's avatar Fred Chasen

Implement footnote counter resets on elements and atpage

parent f1b292bc
Pipeline #687 failed with stage
in 4 minutes and 51 seconds
This diff is collapsed.
const TIMEOUT = 10000;
describe("footnotes-counter-reset-page", () => {
let page;
beforeAll(async () => {
page = await loadPage("notes/footnotes/footnotes-counter-reset-page.html");
return page.rendered;
}, TIMEOUT);
afterAll(async () => {
if (!DEBUG) {
await page.close();
}
});
it("should render 6 pages", async () => {
let pages = await page.$$eval(".pagedjs_page", (r) => {
return r.length;
});
expect(pages).toEqual(6);
});
if (!DEBUG) {
it("should create a pdf", async () => {
let pdf = await page.pdf(PDF_SETTINGS);
expect(pdf).toMatchPDFSnapshot(1);
expect(pdf).toMatchPDFSnapshot(2);
expect(pdf).toMatchPDFSnapshot(6);
});
}
}
);
const TIMEOUT = 10000;
describe("footnotes-counter-reset", () => {
let page;
beforeAll(async () => {
page = await loadPage("notes/footnotes/footnotes-counter-reset.html");
return page.rendered;
}, TIMEOUT);
afterAll(async () => {
if (!DEBUG) {
await page.close();
}
});
it("should render 15 pages", async () => {
let pages = await page.$$eval(".pagedjs_page", (r) => {
return r.length;
});
expect(pages).toEqual(15);
});
if (!DEBUG) {
it("should create a pdf", async () => {
let pdf = await page.pdf(PDF_SETTINGS);
expect(pdf).toMatchPDFSnapshot(1);
expect(pdf).toMatchPDFSnapshot(6);
expect(pdf).toMatchPDFSnapshot(7);
});
}
}
);
......@@ -267,7 +267,7 @@ class Counters extends Handler {
this.styleSheet.insertRule(`[data-page-number="${pageElement.dataset.pageNumber}"] { counter-reset: page ${value} }`, this.styleSheet.cssRules.length);
});
let notereset = pageElement.querySelectorAll("[data-counter-footnote-reset]");
let notereset = pageElement.querySelectorAll("[data-counter-footnote-reset]:not([data-split-from])");
notereset.forEach((reset) => {
let value = reset.dataset.counterFootnoteReset;
this.styleSheet.insertRule(`[data-page-number="${pageElement.dataset.pageNumber}"] .pagedjs_area { counter-reset: footnote ${value} footnote-marker ${value} }`, this.styleSheet.cssRules.length);
......
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