Commit 0f14c97b authored by Nellie McKesson's avatar Nellie McKesson

adding spec file

parent 09148961
This diff is collapsed.
const TIMEOUT = 10000; // Some book might take longer than this to renderer
describe("nth-of-type-selector", () => {
let page;
beforeAll(async () => {
page = await loadPage("nth-of-type-selector/nth-of-type-selector.html");
return page.rendered;
}, TIMEOUT);
afterAll(async () => {
if (!DEBUG) {
await page.close();
}
});
it("should render text", async () => {
let text = await page.evaluate(() => document.body.textContent);
expect(text).toContain("Chapter 1. Loomings.");
});
it("should render 14 pages", async () => {
let pages = await page.$$eval(".pagedjs_page", (r) => r.length);
expect(pages).toBe(14);
});
if (!DEBUG) {
it("should create a pdf", async () => {
let pdf = await page.pdf(PDF_SETTINGS);
expect(pdf).toMatchPDFSnapshot(1);
expect(pdf).toMatchPDFSnapshot(2);
});
}
}
);
......@@ -13,7 +13,7 @@ class NthOfType extends Handler {
onRule(ruleNode, ruleItem, rulelist) {
let selector = csstree.generate(ruleNode.prelude);
if (selector.match(/:(first|last|nth)-of-type/)) {
console.log(ruleNode);
console.log(ruleItem);
console.log(selector);
......
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