fix: positionnement lecteur media (mobile/desktop) et drag libre de la mini-video #110
CI / lint (push) Successful in 2m0s
CI / security (push) Successful in 1m22s
CI / test (push) Successful in 4m36s
CI / build (push) Successful in 1m18s
CI / e2e (push) Successful in 13m7s

This commit is contained in:
2026-09-23 11:42:23 -04:00
parent e3c6789776
commit 80852374a8
14 changed files with 185 additions and 70 deletions
+26
View File
@@ -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);
});
});
+12
View File
@@ -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\)/);