Files
chore/frontend/src/components/shared/__tests__/FloatingActionButton.spec.ts
T
ryan 541bed3a8a
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 3m12s
feat: enhance tutorial functionality by disabling inputs and buttons during active steps
2026-07-21 14:53:31 -04:00

27 lines
883 B
TypeScript

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()
})
})