Skip to content

Commit 0cb9af4

Browse files
committed
test(pdf-server): update inline-pinch e2e for new fullscreen behavior
'trackpad pinch is ignored outside fullscreen' is no longer the contract. Replace with two tests: pinch-in inline -> .main.fullscreen appears; pinch-out inline -> zoom unchanged, no fullscreen. The two pdf-annotations.spec.ts failures in the previous run were flaky (passed on retry).
1 parent c1f91c5 commit 0cb9af4

1 file changed

Lines changed: 28 additions & 3 deletions

File tree

tests/e2e/pdf-viewer-zoom.spec.ts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,13 @@ test.describe("PDF Viewer — fullscreen fit + pinch zoom", () => {
142142
.toBe("");
143143
});
144144

145-
test("trackpad pinch is ignored outside fullscreen", async ({ page }) => {
145+
test("trackpad pinch-in while inline enters fullscreen", async ({ page }) => {
146146
await page.setViewportSize({ width: 1400, height: 800 });
147147
await loadPdfServer(page);
148148
await waitForPdfRender(page);
149149
const app = getAppFrame(page);
150150

151-
const before = await readZoomPercent(page);
151+
await expect(app.locator(".main.fullscreen")).toHaveCount(0);
152152

153153
await app.locator(".canvas-container").evaluate((el) => {
154154
el.dispatchEvent(
@@ -161,8 +161,33 @@ test.describe("PDF Viewer — fullscreen fit + pinch zoom", () => {
161161
);
162162
});
163163

164-
// No settle timer should have started — zoom stays put.
164+
// Pinch-in should request fullscreen, not zoom the inline view.
165+
await expect(app.locator(".main.fullscreen")).toHaveCount(1, {
166+
timeout: 5000,
167+
});
168+
});
169+
170+
test("trackpad pinch-out while inline is a no-op", async ({ page }) => {
171+
await page.setViewportSize({ width: 1400, height: 800 });
172+
await loadPdfServer(page);
173+
await waitForPdfRender(page);
174+
const app = getAppFrame(page);
175+
176+
const before = await readZoomPercent(page);
177+
178+
await app.locator(".canvas-container").evaluate((el) => {
179+
el.dispatchEvent(
180+
new WheelEvent("wheel", {
181+
deltaY: 50, // pinch-out
182+
ctrlKey: true,
183+
bubbles: true,
184+
cancelable: true,
185+
}),
186+
);
187+
});
188+
165189
await page.waitForTimeout(300);
166190
expect(await readZoomPercent(page)).toBe(before);
191+
await expect(app.locator(".main.fullscreen")).toHaveCount(0);
167192
});
168193
});

0 commit comments

Comments
 (0)