feat(nav): tabs, list views and name searches are named in the address
Settings, Configuration and Users name their tab (stab/cfgtab/utab); a link's tab wins and a tab pre-selected while its page is on screen now switches it. A playlist's sort, filters and grouping (plsort/plf/plgroup), the Files sort (fsort, always written) and the name searches of Channels, Files, Playlists and Plex (cq/fq/plq/pq+pqf) reopen from the address; the searches are written once the typing pauses.
This commit is contained in:
@@ -41,4 +41,21 @@ describe("a page's sub-tab, per browser tab", () => {
|
||||
const { result } = renderHook(() => useTabPersistedState("siftlode.adminUsersTab", "roles"));
|
||||
expect(result.current[0]).toBe("access");
|
||||
});
|
||||
|
||||
it("opens on the tab the address names, and keeps it for this browser tab", () => {
|
||||
setTabRaw("siftlode.settingsTab", "account");
|
||||
window.history.replaceState(null, "", "/?page=settings&stab=tokens");
|
||||
const { result, unmount } = renderHook(() =>
|
||||
useTabPersistedState("siftlode.settingsTab", "appearance", "stab"),
|
||||
);
|
||||
expect(result.current[0]).toBe("tokens");
|
||||
unmount();
|
||||
// Back on the page later, through the rail (the page switch cleared its address).
|
||||
window.history.replaceState(null, "", "/?page=settings");
|
||||
expect(
|
||||
renderHook(() => useTabPersistedState("siftlode.settingsTab", "appearance", "stab")).result
|
||||
.current[0],
|
||||
).toBe("tokens");
|
||||
window.history.replaceState(null, "", "/");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user