fix: positionnement lecteur media (mobile/desktop) et drag libre de la mini-video #110
This commit is contained in:
@@ -134,4 +134,30 @@ test.describe('Now Playing — lecture persistante (#110)', () => {
|
||||
await expect(mini).toBeVisible({ timeout: 10000 });
|
||||
await expect(mini.locator('video.np-media--video')).toBeVisible();
|
||||
});
|
||||
|
||||
test('la mini-fenêtre vidéo peut être déplacée librement (centre)', async ({ page }) => {
|
||||
await login(page);
|
||||
await openFile(page, 'TestVault', 'sample-video.webm');
|
||||
await expect(page.locator('#content-area video.np-media--video')).toBeVisible({ timeout: 10000 });
|
||||
await openFile(page, 'TestVault', 'note1.md');
|
||||
|
||||
const mini = page.locator('#now-playing-host .np-dock--video');
|
||||
await expect(mini).toBeVisible({ timeout: 10000 });
|
||||
const before = await mini.evaluate((el) => ({ left: parseFloat(el.style.left), top: parseFloat(el.style.top) }));
|
||||
|
||||
const box = await mini.boundingBox();
|
||||
await page.mouse.move(box.x + box.width / 2, box.y + 12);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(640, 360, { steps: 12 });
|
||||
await page.mouse.up();
|
||||
|
||||
const after = await mini.evaluate((el) => ({ left: parseFloat(el.style.left), top: parseFloat(el.style.top) }));
|
||||
expect(after.left).not.toBe(before.left);
|
||||
expect(after.top).not.toBe(before.top);
|
||||
// Doit pouvoir rester au centre (pas de re-aimantation sur les bords).
|
||||
expect(after.left).toBeGreaterThan(50);
|
||||
expect(after.left).toBeLessThan(900);
|
||||
expect(after.top).toBeGreaterThan(20);
|
||||
expect(after.top).toBeLessThan(600);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -121,6 +121,13 @@ test("now-playing exposes the public controller API and is initialised at boot",
|
||||
assert.match(app, /initNowPlaying\(\)/);
|
||||
});
|
||||
|
||||
test("video mini-window is freely positioned (no corner snapping)", () => {
|
||||
assert.doesNotMatch(np, /nearestCorner/);
|
||||
assert.match(np, /function clampToViewport/);
|
||||
assert.match(np, /left: Math\.round\(r\.left\),\s*\n\s*top: Math\.round\(r\.top\)/);
|
||||
assert.match(np, /bindVideoDrag\(dock\);/);
|
||||
});
|
||||
|
||||
// ── Static checks: CSS ─────────────────────────────────────────────────────
|
||||
test("style.css defines the media viewers and the Now Playing dock", () => {
|
||||
assert.match(css, /\.audio-viewer-container/);
|
||||
@@ -131,6 +138,11 @@ test("style.css defines the media viewers and the Now Playing dock", () => {
|
||||
assert.match(css, /body\.np-active \.content-area/);
|
||||
});
|
||||
|
||||
test("mobile dock uses a grid so actions never overlap the progress bar", () => {
|
||||
assert.match(css, /grid-template-areas:\s*\n\s*"progress progress progress progress"/);
|
||||
assert.match(css, /\.np-dock--audio \[data-np="expand"\]/);
|
||||
});
|
||||
|
||||
test("style.css no longer references undefined --surface1 / --text-dim vars", () => {
|
||||
assert.doesNotMatch(css, /var\(--surface1\)/);
|
||||
assert.doesNotMatch(css, /var\(--text-dim\)/);
|
||||
|
||||
Reference in New Issue
Block a user