import { describe, it, expect } from 'vitest'
import { render, screen, fireEvent } from '@testing-library/react'
import { WysiwygBuilderPage } from '@/components/wysiwyg/WysiwygBuilderPage'

describe('WYSIWYG Builder - Layers acceptance', () => {
  it('visible toggle reflects on layer button state', async () => {
    render(<WysiwygBuilderPage />)
    // add two texts
    fireEvent.click(screen.getByRole('button', { name: /Add Text/i }))
    fireEvent.click(screen.getByRole('button', { name: /Add Text/i }))

    // 레이어 패널에서 visible 토글 버튼 상태만 검증
    const hideBtn = screen.getByTestId('layer-hide-base')
    expect(hideBtn).toHaveAttribute('aria-pressed', 'false')
    fireEvent.click(hideBtn)
    expect(hideBtn).toHaveAttribute('aria-pressed', 'true')
    // 다시 클릭하면 보이도록 토글
    fireEvent.click(hideBtn)
    expect(hideBtn).toHaveAttribute('aria-pressed', 'false')
  })
})
