forked from npmx-dev/npmx.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButtonBase.spec.ts
More file actions
34 lines (30 loc) · 1.25 KB
/
ButtonBase.spec.ts
File metadata and controls
34 lines (30 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { describe, expect, it } from 'vitest'
import { mountSuspended } from '@nuxt/test-utils/runtime'
import ButtonBase from '~/components/Button/Base.vue'
describe('ButtonBase', () => {
it('has cursor-pointer class on enabled button', async () => {
const wrapper = await mountSuspended(ButtonBase)
const button = wrapper.find('button')
expect(button.classes()).toContain('cursor-pointer')
})
it('has cursor-not-allowed on disabled state via class', async () => {
const wrapper = await mountSuspended(ButtonBase, {
props: { disabled: true },
})
const button = wrapper.find('button')
// The class string includes the disabled modifier with cursor-not-allowed
expect(button.attributes('class')).toContain('cursor-not-allowed')
})
it('does not have disabled attribute when not disabled', async () => {
const wrapper = await mountSuspended(ButtonBase)
const button = wrapper.find('button')
expect(button.attributes('disabled')).toBeUndefined()
})
it('has disabled attribute when disabled prop is true', async () => {
const wrapper = await mountSuspended(ButtonBase, {
props: { disabled: true },
})
const button = wrapper.find('button')
expect(button.attributes('disabled')).toBeDefined()
})
})