Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion example/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import useSWR, { Fetcher } from 'swr';
import readiumAfter from 'url:../src/HtmlReader/ReadiumCss/ReadiumCSS-after.css';
import readiumBefore from 'url:../src/HtmlReader/ReadiumCss/ReadiumCSS-before.css';
import readiumDefault from 'url:../src/HtmlReader/ReadiumCss/ReadiumCSS-default.css';
import WebReader, { addTocToManifest } from '../src';
import WebReader from '../src';
import addTocToManifest from '../src/PdfReader/addTocToManifest';
import { Injectable } from '../src/Readium/Injectable';
import { WebpubManifest } from '../src/types';
import { getTheme } from '../src/ui/theme';
Expand Down
256 changes: 160 additions & 96 deletions package-lock.json

Large diffs are not rendered by default.

27 changes: 16 additions & 11 deletions playwright/pageobjects/web-reader.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,30 +204,35 @@ class PdfReaderPage extends WebReaderPage {
}

async getZoomValue(): Promise<number> {
return await this.page
.locator('canvas:visible')
.first()
.evaluate((el) => {
return Number(
window.getComputedStyle(el).getPropertyValue('--scale-factor')
const textLayer = this.pageOne.locator('.textLayer');
let value = 0;
await expect
.poll(async () => {
value = await textLayer.evaluate((el) =>
Number(window.getComputedStyle(el).getPropertyValue('--scale-factor'))
);
});
return value;
})
.toBeGreaterThan(0);
return value;
}

async zoomIn(): Promise<void> {
const beforeScaleFactor = await this.getZoomValue();
await expect(this.zoomInButton).toBeVisible();
await this.zoomInButton.click();
const afterScaleFactor = await this.getZoomValue();
expect(afterScaleFactor).toBeGreaterThan(beforeScaleFactor);
await expect
.poll(() => this.getZoomValue())
.toBeGreaterThan(beforeScaleFactor);
}

async zoomOut(): Promise<void> {
const beforeScaleFactor = await this.getZoomValue();
await expect(this.zoomOutButton).toBeVisible();
await this.zoomOutButton.click();
const afterScaleFactor = await this.getZoomValue();
expect(afterScaleFactor).toBeLessThan(beforeScaleFactor);
await expect
.poll(() => this.getZoomValue())
.toBeLessThan(beforeScaleFactor);
}

async scrollDown(): Promise<void> {
Expand Down
51 changes: 0 additions & 51 deletions src/PdfReader/ChakraPage.tsx

This file was deleted.

Loading
Loading