Commit bd00d569 authored by julien's avatar julien

add test for the position: fixed

parent 088c4030
Pipeline #422 passed with stage
in 3 minutes and 19 seconds
const TIMEOUT = 10000; // Some book might take longer than this to renderer
describe('default', async () => {
describe('element with position: fixed', async () => {
let page;
let rendered;
beforeAll(async () => {
page = await loadPage('default/position-fixed.html')
page = await loadPage('position-fixed/position-fixed.html')
return page.rendered;
}, TIMEOUT)
......@@ -14,17 +14,45 @@ describe('default', async () => {
}
})
it('should render 1 page', async () => {
let pages = await page.$$eval(".pagedjs_page", (r) => r.length);
expect(pages).toBe(5);
})
if (!DEBUG) {
it('should create a pdf', async () => {
let pdf = await page.pdf(PDF_SETTINGS);
expect(pdf).toMatchPDFSnapshot(1);
})
}
it("Page 2 should have a fixed element with a position absolute", async () => {
let text = await page.$eval("#page-2 .fixed", (r) =>
window.getComputedStyle(r).getPropertyValue("position"));
expect(text).toEqual("absolute");
});
it("Page 3 should have a fixed element with a position absolute", async () => {
let text = await page.$eval("#page-3 .fixed", (r) =>
window.getComputedStyle(r).getPropertyValue("position"));
expect(text).toEqual("absolute");
});
it("Page 4 should have a fixed element with a position absolute", async () => {
let text = await page.$eval("#page-4 .fixed", (r) =>
window.getComputedStyle(r).getPropertyValue("position"));
expect(text).toEqual("absolute");
});
it("Page 5 should have a fixed element with a position absolute", async () => {
let text = await page.$eval("#page-5 .fixed", (r) =>
window.getComputedStyle(r).getPropertyValue("position"));
expect(text).toEqual("absolute");
});
it("Page 2 should have a fixed element with a position absolute", async () => {
let text = await page.$eval("#page-2 .sub", (r) =>
window.getComputedStyle(r).getPropertyValue("position"));
expect(text).toEqual("absolute");
});
it("Page 3 should have a fixed element with a position absolute", async () => {
let text = await page.$eval("#page-3 .sub", (r) =>
window.getComputedStyle(r).getPropertyValue("position"));
expect(text).toEqual("absolute");
});
it("Page 4 should have a fixed element with a position absolute", async () => {
let text = await page.$eval("#page-4 .sub", (r) =>
window.getComputedStyle(r).getPropertyValue("position"));
expect(text).toEqual("absolute");
});
it("Page 5 should have a fixed element with a position absolute", async () => {
let text = await page.$eval("#page-5 .sub", (r) =>
window.getComputedStyle(r).getPropertyValue("position"));
expect(text).toEqual("absolute");
});
}
)
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