import { describe, it, expect } from 'vitest'
import { mount } from '@vue/test-utils'
import FloatingActionButton from '../FloatingActionButton.vue'

describe('FloatingActionButton', () => {
  it('emits click when enabled and clicked', async () => {
    const wrapper = mount(FloatingActionButton, {
      props: { ariaLabel: 'Add Child', disabled: false },
    })

    await wrapper.find('button').trigger('click')
    expect(wrapper.emitted('click')).toHaveLength(1)
  })

  it('is disabled and does not emit click when disabled prop is true', async () => {
    const wrapper = mount(FloatingActionButton, {
      props: { ariaLabel: 'Add Child', disabled: true },
    })

    const button = wrapper.find('button')
    expect((button.element as HTMLButtonElement).disabled).toBe(true)

    await button.trigger('click')
    expect(wrapper.emitted('click')).toBeUndefined()
  })
})
