дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 17:47:08 +02:00
Adds Reduce motion under Appearance > Accessibility. When on, or when the system asks for reduced motion, CSS animations and transitions finish at once; script-driven motion reads the same preference. Fixes #5887
24 рядки
742 B
TypeScript
24 рядки
742 B
TypeScript
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
import { reducedMotion } from "./motion";
|
|
|
|
describe("reducedMotion", () => {
|
|
afterEach(() => {
|
|
delete document.documentElement.dataset.reduceMotion;
|
|
vi.unstubAllGlobals();
|
|
});
|
|
const media = (matches: boolean) =>
|
|
vi.stubGlobal("matchMedia", (query: string) => ({ matches: matches && query.includes("reduce") }));
|
|
|
|
it("follows the Reduce motion setting", () => {
|
|
media(false);
|
|
expect(reducedMotion()).toBe(false);
|
|
document.documentElement.dataset.reduceMotion = "";
|
|
expect(reducedMotion()).toBe(true);
|
|
});
|
|
|
|
it("follows the system preference when the setting is off", () => {
|
|
media(true);
|
|
expect(reducedMotion()).toBe(true);
|
|
});
|
|
});
|