fix(ui): drag slider only via arrows handle on phones and make whole trendy bento card clickable
This commit is contained in:
+19
-5
@@ -4,9 +4,10 @@ import { renderToString } from 'react-dom/server';
|
||||
import { Cinematic3DComparison } from '@/components/ui/Cinematic3DComparison';
|
||||
import { CardBeforeAfterSlider } from '@/components/ui/CardBeforeAfterSlider';
|
||||
import { ShiftableToolsGridSection } from '@/components/sections/ShiftableToolsGridSection';
|
||||
import { TrendyBentoSection } from '@/components/sections/TrendyBentoSection';
|
||||
|
||||
describe('Before/After Comparison Sliders (Mobile & Touch Responsiveness)', () => {
|
||||
it('Cinematic3DComparison renders with touch-none, role="slider", and touchAction: none', () => {
|
||||
it('Cinematic3DComparison arrow handle has touch-none, role="slider", and touchAction: none', () => {
|
||||
const html = renderToString(
|
||||
<Cinematic3DComparison
|
||||
beforeUrl="/before.jpg"
|
||||
@@ -17,12 +18,13 @@ describe('Before/After Comparison Sliders (Mobile & Touch Responsiveness)', () =
|
||||
);
|
||||
|
||||
expect(html).toContain('role="slider"');
|
||||
expect(html).toContain('aria-label="Before and after comparison"');
|
||||
expect(html).toContain('aria-label="Before and after comparison slider"');
|
||||
expect(html).toContain('touch-none');
|
||||
expect(html).toContain('touch-action:none');
|
||||
expect(html).toContain('touch-action:pan-y');
|
||||
});
|
||||
|
||||
it('CardBeforeAfterSlider renders with touch-none, role="slider", and touchAction: none', () => {
|
||||
it('CardBeforeAfterSlider arrow handle has touch-none, role="slider", and touchAction: none', () => {
|
||||
const html = renderToString(
|
||||
<CardBeforeAfterSlider
|
||||
beforeUrl="/before.jpg"
|
||||
@@ -34,10 +36,11 @@ describe('Before/After Comparison Sliders (Mobile & Touch Responsiveness)', () =
|
||||
expect(html).toContain('aria-label="Before and after transformation slider"');
|
||||
expect(html).toContain('touch-none');
|
||||
expect(html).toContain('touch-action:none');
|
||||
expect(html).toContain('touch-action:pan-y');
|
||||
expect(html).toContain('--split:50%');
|
||||
});
|
||||
|
||||
it('ShiftableToolsGridSection renders comparison sliders as standalone interactive cards with touch-action: none', () => {
|
||||
it('ShiftableToolsGridSection renders comparison cards as clickable links with handle-only slider dragging', () => {
|
||||
const html = renderToString(
|
||||
<ShiftableToolsGridSection />
|
||||
);
|
||||
@@ -46,6 +49,17 @@ describe('Before/After Comparison Sliders (Mobile & Touch Responsiveness)', () =
|
||||
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');
|
||||
expect(html).toContain('touch-action:pan-y');
|
||||
expect(html).toContain('href="/tools/blemish-remover"');
|
||||
});
|
||||
|
||||
it('TrendyBentoSection renders each tile as a fully clickable card link', () => {
|
||||
const html = renderToString(
|
||||
<TrendyBentoSection />
|
||||
);
|
||||
|
||||
expect(html).toContain('href="/tools/background-remover"');
|
||||
expect(html).toContain('href="/tools/old-photo-restorer"');
|
||||
expect(html).toContain('href="/tools/cartoon-avatar"');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user