feat: make package disclosure motion optional
Add a persisted general setting that keeps package expand and collapse motion enabled by default while allowing remote and lower-performance systems to switch it off. Route the setting through normalized application state and renderer settings, bypass transition grouping when disabled, and retain the existing virtualized package list behavior. Cover legacy defaults, explicit opt-out persistence, settings presentation, and the immediate disclosure path with focused regression tests.
This commit is contained in:
@@ -227,6 +227,19 @@ describe("virtualisierte Paketanimation", () => {
|
||||
renderLimit: 100
|
||||
}));
|
||||
|
||||
it("überspringt die Paketbewegung, wenn sie in den Einstellungen deaktiviert ist", () => {
|
||||
const expanded = logicalRows([]);
|
||||
const prepared = prepareDownloadDisclosureTransition(
|
||||
stableDownloadDisclosureRows(logicalRows([packageA.id])),
|
||||
expanded,
|
||||
false
|
||||
);
|
||||
|
||||
expect(prepared.animated).toBe(false);
|
||||
expect(prepared.rows).toEqual(stableDownloadDisclosureRows(expanded));
|
||||
expect(prepared.rows.some((row) => row.type === "item-group")).toBe(false);
|
||||
});
|
||||
|
||||
it("zeichnet den Startzustand in einem eigenen Frame vor der Aktivierung", () => {
|
||||
const frames: FrameRequestCallback[] = [];
|
||||
const cancelled: number[] = [];
|
||||
@@ -659,6 +672,7 @@ function withRuntime(input: DownloadsModelInput, overrides: Record<string, unkno
|
||||
scheduleLabel: "",
|
||||
packageSpeedBps: { "package-a": 12_000_000 },
|
||||
disclosureRevision: 0,
|
||||
animatePackageDisclosure: true,
|
||||
editingPackageId: null,
|
||||
editingName: "",
|
||||
columnOrder: ["name", "size", "hoster", "progress"] as const,
|
||||
|
||||
@@ -506,6 +506,24 @@ describe("settings views", () => {
|
||||
expect(settingsCss).toMatch(/\.settings-select\.is-open\s+\.settings-select-options\s*\{[^}]*opacity:\s*1[^}]*transform:\s*translateY\(0\)/s);
|
||||
});
|
||||
|
||||
it("offers a general switch for package expand and collapse motion", () => {
|
||||
const form = buildSettingsFormViewModel({
|
||||
settings: { ...createRendererSettings(defaultSettings()), archivePasswordList: "", notifyUrl: "" },
|
||||
section: "allgemein",
|
||||
speedLimitInput: "0",
|
||||
scheduleSpeedInputs: {}
|
||||
});
|
||||
const animation = form.groups.flatMap((group) => group.fields)
|
||||
.find((field) => field.id === "animatePackageDisclosure");
|
||||
|
||||
expect(animation).toEqual({
|
||||
id: "animatePackageDisclosure",
|
||||
kind: "switch",
|
||||
label: "Paket-Ein-/Ausklappen animieren",
|
||||
value: true
|
||||
});
|
||||
});
|
||||
|
||||
it("supports keyboard navigation in animated settings selects", () => {
|
||||
expect(getSettingsSelectNavigationIndex(1, 3, "ArrowDown")).toBe(2);
|
||||
expect(getSettingsSelectNavigationIndex(2, 3, "ArrowDown")).toBe(0);
|
||||
|
||||
@@ -36,6 +36,14 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe("settings storage", () => {
|
||||
it("enables package disclosure motion by default and preserves an explicit opt-out", () => {
|
||||
const legacy = { ...defaultSettings() } as Partial<AppSettings>;
|
||||
delete legacy.animatePackageDisclosure;
|
||||
|
||||
expect(normalizeSettings(legacy as AppSettings).animatePackageDisclosure).toBe(true);
|
||||
expect(normalizeSettings({ ...defaultSettings(), animatePackageDisclosure: false }).animatePackageDisclosure).toBe(false);
|
||||
});
|
||||
|
||||
it("repairs a persisted version-2 column order that lost availability during default merging", () => {
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "rd-store-"));
|
||||
tempDirs.push(dir);
|
||||
|
||||
@@ -117,6 +117,7 @@ function createSettings(): AppSettings {
|
||||
theme: "dark",
|
||||
logStorageLocation: "appdata",
|
||||
collapseNewPackages: false,
|
||||
animatePackageDisclosure: true,
|
||||
historyRetentionMode: "permanent",
|
||||
historyMaxEntries: 500,
|
||||
historyMaxAgeDays: 0,
|
||||
|
||||
Reference in New Issue
Block a user