import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { Label } from '../label';

describe('Label', () => {
  it('renders label text', () => {
    render(<Label>Số điện thoại</Label>);
    expect(screen.getByText('Số điện thoại')).toBeInTheDocument();
  });

  it('associates with input via htmlFor', () => {
    render(
      <>
        <Label htmlFor="phone">Phone</Label>
        <input id="phone" />
      </>,
    );
    expect(screen.getByLabelText('Phone')).toBeInTheDocument();
  });

  it('applies custom className', () => {
    render(<Label data-testid="label" className="custom">Label</Label>);
    expect(screen.getByTestId('label')).toHaveClass('custom');
  });
});
