mirror of
https://github.com/tgeorgiadis/quiver-launcher.git
synced 2026-11-26 07:11:27 -05:00
* Let the library's playlists go in a side panel, and call the Steam-style layout List (#413) In the Grid layout, View options has a Playlists position choice: Top of library (the tabs as before) or Side panel, which puts All, Updates, Hidden and the playlists down the left, as Quiver Launcher 3's tag filters were. A right-click on the tabs or the panel moves them to the other place. Players who brought a 3.x library over get a one-time tip offering it. Narrow windows, phones and TV mode keep the tabs on top. The Steam-style layout is now called List, so side panel only means the playlists. It's still saved as sidebar, so nothing needs moving over and older launchers read it as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015HpW14ydYUX1SCzG2p96Vh * Lay out the List layout's filters again, and say when a playlist's apps are hidden The grid's centred filter bar rules matched the List layout's filters panel by its id, splitting it into columns. They now leave the panel alone. An empty tab or playlist whose apps are only hidden by the Hidden apps filter says how many there are, with a Show hidden apps button that sets the filter to show them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015HpW14ydYUX1SCzG2p96Vh * Wait for all three cards before the Shift+click range test reads their order The catalog's cards come in after the first one, so on a busy runner the order was read from fewer cards than the range then selected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015HpW14ydYUX1SCzG2p96Vh * Read the Rename dialog's name once it has filled the field The field is filled just after the dialog shows, so on a busy runner the test read it empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015HpW14ydYUX1SCzG2p96Vh * Shift+click selects the range from the card clicked before, however busy the page is The range was worked out in React's update, which can run after the click has already moved the anchor to the card clicked, selecting only that one. It now reads the anchor and the order at the click. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015HpW14ydYUX1SCzG2p96Vh * With the playlists in the side panel, the search goes beside the tools where there's room Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015HpW14ydYUX1SCzG2p96Vh * Match the Shift+click fix to PR 484's, so the two merge cleanly Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015HpW14ydYUX1SCzG2p96Vh --------- Co-authored-by: Claude <noreply@anthropic.com>
111 lines
6.7 KiB
JavaScript
111 lines
6.7 KiB
JavaScript
/**
|
||
* What a controller brings to every screen: the hints along the bottom, the focus's ring, and the shoulder buttons. (controller.js has what these share.)
|
||
*/
|
||
import { test } from "node:test";
|
||
import assert from "node:assert/strict";
|
||
import { app, appPage, everything, home, open, page, s, useSharedApp } from "./controller.js";
|
||
import * as reach from "../reach.js";
|
||
|
||
useSharedApp();
|
||
|
||
test("with a controller connected, the bottom says what its buttons do, as it labels them, and Settings hides it", async () => {
|
||
// As gamepad.rs says a controller has come (and which), so it runs the same with none plugged in.
|
||
const send = (event, payload) => app.execute((event, payload) => window.__TAURI_INTERNALS__.invoke("plugin:event|emit", { event, payload }), event, payload);
|
||
const xbox = { kind: "xbox", south: "A", east: "B", west: "X", north: "Y" };
|
||
const hints = () => app.execute(() => [...document.querySelectorAll(".pad-hints > span")].map((s) => s.innerText.replace(/\s+/g, " ").trim()));
|
||
await send("pads", ["Test pad"]);
|
||
await send("pad-labels", xbox);
|
||
await home();
|
||
await open("button", { text: "Library" });
|
||
await s.until(async () => (await hints()).length > 0);
|
||
// On a library card: A plays it, Y opens its menu.
|
||
await app.execute(() => document.querySelector(".library-tile .card-open").focus());
|
||
await s.until(async () => (await hints()).join(", ").startsWith("A Play, Y Menu"));
|
||
// On a catalog card: A opens it, Y opens its menu, X adds it, with that button showing X.
|
||
await open("button", { text: "Browse" });
|
||
await app.execute(() => document.querySelector('article[data-slug="tampered-port"] .card-open').focus());
|
||
await s.until(async () => (await hints()).join(", ").startsWith("A Open, Y Menu, X Add"));
|
||
await s.until(() => app.execute(() => document.querySelector('article[data-slug="tampered-port"] .card-action .primary')?.getAttribute("data-pad-glyph") === "X"));
|
||
await open("button", { text: "Library" });
|
||
// It doesn't cover the page: the d-pad still gets everywhere, every move in sight above it.
|
||
await everything("the library, with the hints");
|
||
// In the List layout: only beside the list, which runs to the window's bottom.
|
||
const layout = async (name) => {
|
||
await open('button[aria-label="View options"]');
|
||
await app.execute((name) => [...document.querySelectorAll("button")].find((b) => b.innerText.trim() === name).focus(), name);
|
||
await reach.press(app, "South");
|
||
await reach.press(app, "East");
|
||
};
|
||
await layout("List");
|
||
const at = () =>
|
||
app.execute(() => {
|
||
const side = document.querySelector(".library-sidebar").getBoundingClientRect();
|
||
const top = document.querySelector(".topbar").getBoundingClientRect().height;
|
||
return { bar: document.querySelector(".pad-hints").getBoundingClientRect().left, side: side.right, tall: side.height, room: document.documentElement.clientHeight - top };
|
||
});
|
||
await s.until(async () => {
|
||
const { bar, side } = await at();
|
||
return Math.abs(bar - side) < 2;
|
||
});
|
||
// As tall as the window under the top bar: not cut short for the hints.
|
||
const { tall, room } = await at();
|
||
assert.ok(Math.abs(tall - room) < 2, `the sidebar runs to the bottom (${tall} of ${room})`);
|
||
// Its foot's strip and the hints beside it: their tops one line, once the page has scrolled the sidebar up under the top bar.
|
||
await app.execute(() => document.querySelector(".shell > main").scrollTo(0, document.querySelector(".shell > main").scrollHeight));
|
||
const tops = () => app.execute(() => [".library-sidebar .sidebar-foot", ".pad-hints"].map((s) => document.querySelector(s).getBoundingClientRect().top));
|
||
await s.until(async () => {
|
||
const [foot, hints] = await tops();
|
||
return Math.abs(foot - hints) < 1.5;
|
||
}, 5000).catch(async () => assert.fail(`the foot's top and the hints' top: ${(await tops()).join(" and ")}`));
|
||
await app.execute(() => document.querySelector(".shell > main").scrollTo(0, 0));
|
||
await everything("the sidebar layout, with the hints");
|
||
await layout("Grid");
|
||
// On a page: B goes back.
|
||
assert.equal(await appPage(), "page: Test Port");
|
||
await s.until(async () => (await hints()).includes("B Back"));
|
||
// A PlayStation pad's labels.
|
||
await send("pad-labels", { kind: "playstation", south: "Cross", east: "Circle", west: "Square", north: "Triangle" });
|
||
await s.until(async () => (await hints()).some((h) => h.startsWith("✕ ")) && (await hints()).includes("○ Back"));
|
||
// Settings › Controllers: its switch, with the controller, hides it and shows it again.
|
||
await home();
|
||
await open('button[aria-label="Settings"]');
|
||
await open('nav[aria-label="Settings sections"] button', { text: "Controllers" });
|
||
const showing = () => app.execute(() => Boolean(document.querySelector(".pad-hints")));
|
||
await app.execute(() => [...document.querySelectorAll(".controls label.toggle")].find((l) => l.innerText.includes("Show what the buttons do")).querySelector("input").focus());
|
||
await reach.press(app, "South");
|
||
await s.until(async () => !(await showing()));
|
||
await reach.press(app, "South");
|
||
await s.until(showing);
|
||
// And none connected, none shown.
|
||
await send("pads", []);
|
||
await s.until(async () => !(await app.execute(() => Boolean(document.querySelector(".pad-hints")))));
|
||
});
|
||
|
||
test("after a mouse click, and back in front of other windows, a controller's focus has its ring", async () => {
|
||
await home();
|
||
const ringed = () => app.execute(() => document.activeElement?.matches(":focus-visible") ?? false);
|
||
// A click with the mouse, then the d-pad: the browser alone would leave the ring off.
|
||
await page.getByRole("button", { name: "Browse", exact: true }).click();
|
||
await reach.press(app, "DPadDown");
|
||
assert.ok(await ringed(), "the d-pad's focus shows after a click");
|
||
// Back in front of other windows, as the controller left it: the ring the browser dropped comes back. A script's
|
||
// focus after a ringed one keeps the ring in WebView2 and WebKitGTK alike, so this may not drop it; either way it shows after.
|
||
await app.execute(() => {
|
||
const at = document.activeElement;
|
||
at.blur();
|
||
at.focus();
|
||
});
|
||
const dropped = !(await ringed());
|
||
await app.execute(() => window.dispatchEvent(new FocusEvent("focus")));
|
||
assert.ok(await ringed(), dropped ? "the window's focus brings it back" : "the window's focus keeps it");
|
||
});
|
||
|
||
test("outside TV mode, the shoulder buttons go between Library and Browse, as they do between TV mode's tabs", async () => {
|
||
const showing = () => app.execute(() => document.querySelector('.topbar [data-tabs] [aria-current="page"]')?.innerText.trim() ?? "");
|
||
assert.match(await showing(), /^Library/);
|
||
await reach.press(app, "RightTrigger");
|
||
await s.until(async () => /^Browse/.test(await showing()));
|
||
await reach.press(app, "LeftTrigger");
|
||
await s.until(async () => /^Library/.test(await showing()));
|
||
});
|