fix(slider): add pointer capture, touch-action none, link isolation, and zero-reflow RAF tracking for ultra-smooth mobile responsiveness
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import React from 'react';
|
||||
import { renderToString } from 'react-dom/server';
|
||||
import { Cinematic3DComparison } from '@/components/ui/Cinematic3DComparison';
|
||||
import { CardBeforeAfterSlider } from '@/components/ui/CardBeforeAfterSlider';
|
||||
import { ShiftableToolsGridSection } from '@/components/sections/ShiftableToolsGridSection';
|
||||
|
||||
describe('Before/After Comparison Sliders (Mobile & Touch Responsiveness)', () => {
|
||||
it('Cinematic3DComparison renders with touch-none, role="slider", and touchAction: none', () => {
|
||||
const html = renderToString(
|
||||
<Cinematic3DComparison
|
||||
beforeUrl="/before.jpg"
|
||||
afterUrl="/after.jpg"
|
||||
beforeLabel="Original"
|
||||
afterLabel="Enhanced"
|
||||
/>
|
||||
);
|
||||
|
||||
expect(html).toContain('role="slider"');
|
||||
expect(html).toContain('aria-label="Before and after comparison"');
|
||||
expect(html).toContain('touch-none');
|
||||
expect(html).toContain('touch-action:none');
|
||||
});
|
||||
|
||||
it('CardBeforeAfterSlider renders with touch-none, role="slider", and touchAction: none', () => {
|
||||
const html = renderToString(
|
||||
<CardBeforeAfterSlider
|
||||
beforeUrl="/before.jpg"
|
||||
afterUrl="/after.jpg"
|
||||
/>
|
||||
);
|
||||
|
||||
expect(html).toContain('role="slider"');
|
||||
expect(html).toContain('aria-label="Before and after transformation slider"');
|
||||
expect(html).toContain('touch-none');
|
||||
expect(html).toContain('touch-action:none');
|
||||
expect(html).toContain('--split:50%');
|
||||
});
|
||||
|
||||
it('ShiftableToolsGridSection renders comparison sliders as standalone interactive cards with touch-action: none', () => {
|
||||
const html = renderToString(
|
||||
<ShiftableToolsGridSection />
|
||||
);
|
||||
|
||||
expect(html).toContain('role="slider"');
|
||||
expect(html).toContain('aria-label="Before and after comparison slider"');
|
||||
expect(html).toContain('touch-none');
|
||||
expect(html).toContain('touch-action:none');
|
||||
expect(html).toContain('TRY TOOL');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user