import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell } from '../table';
describe('Table', () => {
it('renders a complete table structure', () => {
render(
Name
Price
Apartment
1,000,000 VND
,
);
expect(screen.getByRole('table')).toBeInTheDocument();
expect(screen.getByText('Name')).toBeInTheDocument();
expect(screen.getByText('Price')).toBeInTheDocument();
expect(screen.getByText('Apartment')).toBeInTheDocument();
expect(screen.getByText('1,000,000 VND')).toBeInTheDocument();
});
it('renders multiple rows', () => {
render(
,
);
expect(screen.getAllByRole('row')).toHaveLength(3);
});
it('applies custom className to table elements', () => {
render(
,
);
expect(screen.getByTestId('row')).toHaveClass('highlight');
expect(screen.getByTestId('cell')).toHaveClass('bold');
});
});