/**
 * (share/components — happy/negative/error branches per sheet gates).
 */
import React from 'react'
import { render, screen } from '@testing-library/react'
import ContainerFormBody from '../index'

describe('[share/components/form]', () => {
  describe('ContainerFormBody', () => {
    it('renders children inside a styled form element', () => {
      render(
        <ContainerFormBody>
          <button type="submit">Submit</button>
        </ContainerFormBody>,
      )
      const form = document.querySelector('form')
      expect(form).toBeInTheDocument()
      expect(form).toHaveClass('flex', 'flex-col', 'gap-6')
      expect(screen.getByRole('button', { name: 'Submit' })).toBeInTheDocument()
    })

    it('forwards native form attributes (contract)', () => {
      render(
        <ContainerFormBody action="/api" method="post" data-testid="form">
          <span>Content</span>
        </ContainerFormBody>,
      )
      const form = screen.getByTestId('form')
      expect(form).toHaveAttribute('action', '/api')
      expect(form).toHaveAttribute('method', 'post')
    })
  })
})
