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

describe('UiTableEmpty', () => {
  test('applies custom class', () => {
    const { getByRole } = render(UiTableEmpty, {
      props: { class: 'custom-class' },
      slots: { default: 'Empty' },
    });

    expect(getByRole('cell')).toHaveClass('custom-class');
  });

  test('defaults colspan to 1', () => {
    const { container } = render(UiTableEmpty, {
      slots: { default: 'Empty' },
    });

    expect(container.querySelector('td')).toHaveAttribute('colspan', '1');
  });

  test('applies custom colspan', () => {
    const { container } = render(UiTableEmpty, {
      props: { colspan: 4 },
      slots: { default: 'Empty' },
    });

    expect(container.querySelector('td')).toHaveAttribute('colspan', '4');
  });
});
