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';
import { TrendyBentoSection } from '@/components/sections/TrendyBentoSection';
import { ToolGridSection } from '@/components/sections/ToolGridSection';
describe('Before/After Comparison Sliders (Mobile & Touch Responsiveness)', () => {
it('Cinematic3DComparison arrow handle has touch-none, role="slider", and touchAction: none', () => {
const html = renderToString(
);
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('touch-action:pan-y');
});
it('CardBeforeAfterSlider arrow handle has touch-none, role="slider", and touchAction: none', () => {
const html = renderToString(
);
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('touch-action:pan-y');
expect(html).toContain('--split:50%');
});
it('ShiftableToolsGridSection renders comparison cards as clickable links with handle-only slider dragging', () => {
const html = renderToString(
);
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('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(
);
expect(html).toContain('href="/tools/background-remover"');
expect(html).toContain('href="/tools/old-photo-restorer"');
expect(html).toContain('href="/tools/cartoon-avatar"');
});
it('ToolGridSection comparison cards allow smooth mobile scrolling (touch-action: pan-y) and drag only on handle button (touch-action: none)', () => {
const html = renderToString(
);
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('touch-action:pan-y');
expect(html).toContain('touch-pan-y');
});
});