feat(accounts): add precise service filtering

Add an explicit service selector to the account creation dialog while keeping the text field focused on access types such as API and web login. Preserve the result area dimensions during filtering and allow Enter to choose the first visible account type. Cover filtering, keyboard selection, translations, and stable list geometry with focused regression tests.
This commit is contained in:
Sucukdeluxe
2026-08-15 18:46:18 +02:00
parent a3b4b2323f
commit 5747a50932
7 changed files with 147 additions and 56 deletions
+14
View File
@@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import {
buildConfiguredProviderOrder,
filterAccountDialogOptions,
getAccountDialogSelectableOptions,
isAccountRowSelectionKey,
matchesAccountModeFilter,
@@ -22,6 +23,19 @@ describe("account mode filter", () => {
});
});
describe("account dialog filter", () => {
const options = [
{ id: "rd-api", serviceLabel: "Real-Debrid", title: "Real-Debrid API", modeLabel: "API", pickerDescription: "API-Token" },
{ id: "rd-web", serviceLabel: "Real-Debrid", title: "Real-Debrid Web-Login", modeLabel: "Web-Login", pickerDescription: "Browserfenster" },
{ id: "md-api", serviceLabel: "Mega-Debrid", title: "Mega-Debrid API", modeLabel: "API", pickerDescription: "Login:Passwort" }
];
it("combines an exact service choice with an access-type search", () => {
expect(filterAccountDialogOptions(options, "web", "Real-Debrid").map((option) => option.id)).toEqual(["rd-web"]);
expect(filterAccountDialogOptions(options, "api", "all").map((option) => option.id)).toEqual(["rd-api", "md-api"]);
});
});
describe("account provider order", () => {
it("preserves the custom provider order while accounts are disabled", () => {
expect(buildConfiguredProviderOrder(