import React from 'react'; import { render, screen } from '@testing-library/react'; import '@testing-library/jest-dom'; import { CarouselItem } from '../CarouselItem'; describe('CarouselItem', () => { it('renders children correctly', () => { render(
Test Content
); expect(screen.getByText('Test Content')).toBeInTheDocument(); }); it('applies custom className', () => { const { container } = render(
Test Content
); expect(container.firstChild).toHaveClass('custom-class'); }); it('uses default widthConfig when not provided', () => { const { container } = render(
Test Content
); expect(container.firstChild).toBeInTheDocument(); }); it('accepts custom widthConfig', () => { render(
Test Content
); expect(screen.getByText('Test Content')).toBeInTheDocument(); }); it('accepts partial widthConfig', () => { render(
Test Content
); expect(screen.getByText('Test Content')).toBeInTheDocument(); }); it('renders multiple children correctly', () => { render(
Child 1
Child 2
Child 3
); expect(screen.getByText('Child 1')).toBeInTheDocument(); expect(screen.getByText('Child 2')).toBeInTheDocument(); expect(screen.getByText('Child 3')).toBeInTheDocument(); }); it('handles complex child components', () => { const ComplexChild = () => (

Title

Description

); render( ); expect(screen.getByText('Title')).toBeInTheDocument(); expect(screen.getByText('Description')).toBeInTheDocument(); expect(screen.getByText('Action')).toBeInTheDocument(); }); it('applies className along with widthConfig', () => { const { container } = render(
Test Content
); expect(container.firstChild).toHaveClass('custom-item'); expect(screen.getByText('Test Content')).toBeInTheDocument(); }); it('renders with no props except children', () => { render(
Minimal Content
); expect(screen.getByText('Minimal Content')).toBeInTheDocument(); }); it('handles empty widthConfig object', () => { render(
Test Content
); expect(screen.getByText('Test Content')).toBeInTheDocument(); }); });