Disable row and height animations when removing downloads
This commit is contained in:
@@ -38,7 +38,8 @@ import {
|
||||
getDownloadOrderTransitionPinnedIds,
|
||||
getDownloadOrderTransformKeyframes,
|
||||
isDownloadPackageOrderChange,
|
||||
shouldAnimateDownloadOrderChange
|
||||
shouldAnimateDownloadOrderChange,
|
||||
hasRemovedDownloadItems
|
||||
} from "../src/renderer/views/downloads/download-order-transition";
|
||||
import {
|
||||
DownloadsContent,
|
||||
@@ -386,6 +387,14 @@ describe("virtualisierte Paketanimation", () => {
|
||||
expect(shouldAnimateDownloadOrderChange({ animationsEnabled: false, sortRevision: 3, appliedSortRevision: 3 })).toBe(false);
|
||||
});
|
||||
|
||||
it("detects removed queue entries even when another entry is added in the same update", () => {
|
||||
expect(hasRemovedDownloadItems({ first: {}, second: {} }, { second: {} })).toBe(true);
|
||||
expect(hasRemovedDownloadItems({ first: {}, second: {} }, { second: {}, third: {} })).toBe(true);
|
||||
expect(hasRemovedDownloadItems({ first: {} }, {})).toBe(true);
|
||||
expect(hasRemovedDownloadItems({ first: {} }, { first: { status: "completed" }, second: {} })).toBe(false);
|
||||
expect(hasRemovedDownloadItems(undefined, { first: {} })).toBe(false);
|
||||
});
|
||||
|
||||
it("pins only previously visible rows for a real priority reorder", () => {
|
||||
expect(DOWNLOAD_ORDER_TRANSITION_DURATION_MS).toBe(3000);
|
||||
expect(isDownloadPackageOrderChange(["a", "b", "c"], ["b", "c", "a"])).toBe(true);
|
||||
|
||||
@@ -205,5 +205,6 @@ export async function startVisualHarness(
|
||||
}
|
||||
|
||||
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
||||
if (new URLSearchParams(window.location.search).has("check-removal-motion")) void import("./removal-motion-probe");
|
||||
startVisualHarness();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
let checks = 0;
|
||||
let movingChecks = 0;
|
||||
const observer = new MutationObserver(() => {
|
||||
const body = document.querySelector(".downloads-table-body");
|
||||
if (!body) return;
|
||||
checks++;
|
||||
const moving = [...body.querySelectorAll<HTMLElement>(".downloads-virtual-row")].some((row) => {
|
||||
const target = Number.parseFloat(row.style.getPropertyValue("--downloads-virtual-row-top"));
|
||||
return Math.abs(new DOMMatrixReadOnly(getComputedStyle(row).transform).m42 - target) > 0.5;
|
||||
});
|
||||
const spacer = body.querySelector<HTMLElement>(".downloads-virtual-spacer");
|
||||
const resizing = spacer && Math.abs(spacer.getBoundingClientRect().height - Number.parseFloat(spacer.style.getPropertyValue("--downloads-virtual-total-height"))) > 0.5;
|
||||
if (moving || resizing) movingChecks++;
|
||||
document.documentElement.dataset.removalMotion = JSON.stringify({ checks, movingChecks });
|
||||
});
|
||||
observer.observe(document.body, { subtree: true, childList: true, attributes: true, attributeFilter: ["style", "class"] });
|
||||
|
||||
export {};
|
||||
Reference in New Issue
Block a user