feat(player): the YouTube player and the file viewer are named in the address
The player names what it plays in its own history entry (watch, wrel, wtab): a reload or a
bookmark reopens it on the page that hosts it, with that page's list as the queue, or alone
from the catalog (GET /api/videos/{id}/row); a page that hosts none gets the shell's. Back
lands on the page's address without it (useBackToClose's url; ui/Modal passes it on). The
Files viewer and player do the same (fview, fplay). The Plex and channel-manager views are
always written in full, as their fallback is remembered state.
This commit is contained in:
@@ -16,6 +16,7 @@ import { plexParamUpdates, plexSearchParamUpdates } from "./lib/plexUrlState";
|
||||
import { activityParamUpdates, DEFAULT_ACTIVITY_STATE } from "./lib/activityUrlState";
|
||||
import { DEFAULT_LOGS_STATE, logsParamUpdates } from "./lib/logsUrlState";
|
||||
import { FILES_KEYS } from "./lib/filesUrlState";
|
||||
import { PLAYER_KEYS, playerParamUpdates } from "./lib/playerUrlState";
|
||||
import { playlistViewParamUpdates } from "./lib/playlistsUrlState";
|
||||
import { SETTINGS_TAB_KEY } from "./lib/settingsTab";
|
||||
import { CONFIG_TAB_KEY } from "./lib/configTab";
|
||||
@@ -128,6 +129,14 @@ describe("module URL keys", () => {
|
||||
);
|
||||
});
|
||||
|
||||
// The player opens over any page too, and names itself in its own history entry.
|
||||
it("leave the player's keys to the shell", () => {
|
||||
const shell: readonly string[] = SHELL_KEYS;
|
||||
expect(PLAYER_KEYS.filter((k) => !shell.includes(k))).toEqual([]);
|
||||
const written = playerParamUpdates({ watch: "v1", related: "v2", panel: "related" });
|
||||
expect(Object.keys(written).sort()).toEqual([...PLAYER_KEYS].sort());
|
||||
});
|
||||
|
||||
it.each([...REGISTERED_PAGES])("are exactly what %s's encoders write", (page) => {
|
||||
const declared = [...moduleDef(page).urlKeys].sort();
|
||||
const writes = WRITES[page];
|
||||
|
||||
Reference in New Issue
Block a user