import '@testing-library/jest-dom/vitest';
import { render } from '@testing-library/vue';
import { describe, expect, test } from 'vitest';
import UiTableCell from '../UiTableCell.vue';

describe('UiTableCell', () => {
  test('applies custom class', () => {
    const { getByRole } = render(UiTableCell, {
      props: { class: 'text-right font-medium' },
      slots: { default: '$100.00' },
    });

    expect(getByRole('cell')).toHaveClass('text-right', 'font-medium');
  });

  test('applies colspan and rowspan attributes', () => {
    const { container } = render(UiTableCell, {
      props: { colspan: 2, rowspan: 2 },
      slots: { default: 'Large Cell' },
    });

    const cell = container.querySelector('td');
    expect(cell).toHaveAttribute('colspan', '2');
    expect(cell).toHaveAttribute('rowspan', '2');
  });
});
