/**
 * (share/ui/checkbox — slot wiring).
 */
import React from 'react'
import { render } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { Checkbox } from '@/share/ui/checkbox'

jest.mock('radix-ui', () => ({
  Checkbox: {
    Root: ({ children, ...p }: any) => (
      <button type="button" data-slot="checkbox" {...p}>
        {children}
      </button>
    ),
    Indicator: () => <span data-slot="checkbox-indicator" />,
  },
}))
jest.mock('lucide-react', () => ({ CheckIcon: () => null }))

describe('[share/ui/checkbox]', () => {
  describe('Checkbox', () => {
    it('mounts checkbox root slot', () => {
      render(<Checkbox />)
      expect(document.querySelector('[data-slot="checkbox"]')).toBeInTheDocument()
    })

    it('remains interactive when clicked (happy path)', async () => {
      const user = userEvent.setup()
      render(<Checkbox />)
      const el = document.querySelector('[data-slot="checkbox"]') as HTMLElement
      await user.click(el)
      expect(el).toBeInTheDocument()
    })
  })
})
