Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 3m12s
27 lines
883 B
TypeScript
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()
|
|
})
|
|
})
|