Nychthemeron/packages/library/tests/Checkbox.spec.ts
Matthew L McPeak 302a58c258
Some checks failed
ci / build (push) Failing after 21s
ci / publish (push) Has been skipped
ci / publish-docs (push) Has been skipped
Inital Commit
2026-07-15 20:01:01 -04:00

21 lines
767 B
TypeScript

import { describe, it, expect } from 'vitest'
import { mount } from '@vue/test-utils'
import { Checkbox } from '../src/lib'
describe('Checkbox', () => {
it('renders unchecked by default', () => {
const wrapper = mount(Checkbox)
expect(wrapper.get('button').attributes('data-state')).toBe('unchecked')
})
it('reflects modelValue as checked', () => {
const wrapper = mount(Checkbox, { props: { modelValue: true } })
expect(wrapper.get('button').attributes('data-state')).toBe('checked')
})
it('emits update:modelValue on click', async () => {
const wrapper = mount(Checkbox, { props: { modelValue: false } })
await wrapper.get('button').trigger('click')
expect(wrapper.emitted('update:modelValue')?.[0]).toEqual([true])
})
})