fix: fragmentation

This commit is contained in:
2026-05-14 14:57:54 +02:00
parent 13693165df
commit 9cc7249278
3 changed files with 32 additions and 8 deletions
+15 -3
View File
@@ -429,18 +429,30 @@ describe('HomeComponent', (): void => {
// ── RAF debouncing (performance) ───────────────────────────────────────────
describe('Performance', (): void => {
it('should keep scroll effects enabled on small viewports when motion is allowed', (): void => {
spyOnProperty(window, 'innerWidth').and.returnValue(390);
it('should keep scroll effects enabled on desktop pointers when motion is allowed', (): void => {
spyOn(window, 'matchMedia').and.callFake(
(query: string): MediaQueryList =>
({
matches: query !== '(prefers-reduced-motion: reduce)',
matches:
query !== '(prefers-reduced-motion: reduce)' &&
query !== '(hover: none) and (pointer: coarse)',
}) as MediaQueryList,
);
expect(comp.shouldEnableScrollEffects()).toBeTrue();
});
it('should disable scroll effects on coarse touch pointers', (): void => {
spyOn(window, 'matchMedia').and.callFake(
(query: string): MediaQueryList =>
({
matches: query === '(hover: none) and (pointer: coarse)',
}) as MediaQueryList,
);
expect(comp.shouldEnableScrollEffects()).toBeFalse();
});
it('should disable scroll effects when reduced motion is requested', (): void => {
spyOn(window, 'matchMedia').and.callFake(
(query: string): MediaQueryList =>
+4 -1
View File
@@ -227,8 +227,11 @@ export class HomeComponent implements OnInit, AfterViewInit, OnDestroy {
const prefersReducedMotion: boolean = window.matchMedia(
'(prefers-reduced-motion: reduce)',
).matches;
const usesTouchScrolling: boolean = window.matchMedia(
'(hover: none) and (pointer: coarse)',
).matches;
return !prefersReducedMotion;
return !prefersReducedMotion && !usesTouchScrolling;
}
private initNameGradientScrollAnimation(): void {