fix: fragmentation
This commit is contained in:
@@ -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 =>
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user