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

describe('UiSpinner', () => {
  test('renders with role="status" and default aria-label', () => {
    const { getByRole } = render(UiSpinner);
    const spinner = getByRole('status');
    expect(spinner).toBeInTheDocument();
    expect(spinner).toHaveAttribute('aria-label', 'Loading');
  });

  test('accepts custom aria-label', () => {
    const { getByRole } = render(UiSpinner, {
      props: { ariaLabel: 'Submitting form' },
    });
    expect(getByRole('status')).toHaveAttribute(
      'aria-label',
      'Submitting form',
    );
  });
});
