// @vitest-environment happy-dom
import { afterEach, describe, expect, it } from 'vitest'
import { cleanup, render, screen } from '@testing-library/react'
import { Toggle } from '../../components/ui/Toggle.js'

afterEach(cleanup)

describe('Toggle', () => {
  it('positions the thumb with design-system absolute offsets', () => {
    render(<Toggle checked={false} onCheckedChange={() => {}} aria-label="Test toggle" />)
    const thumb = screen.getByRole('switch').querySelector('span')
    expect(thumb?.className).toContain('absolute')
    expect(thumb?.className).toContain('top-[2.5px]')
    expect(thumb?.className).toContain('left-[2.5px]')
    expect(thumb?.className).toContain('data-[state=checked]:left-[19.5px]')
  })
})
