✅ test: added a test that prevents clicking when the link is disabled
This commit is contained in:
parent
672e5ec36c
commit
020ac1bc8d
|
@ -1,6 +1,6 @@
|
|||
import { mount } from '@vue/test-utils'
|
||||
import VLink from '../src/components/button/VLink.vue'
|
||||
import {test, expect, describe} from 'vitest'
|
||||
import {test, expect, describe, vi} from 'vitest'
|
||||
|
||||
describe('VLink', () => {
|
||||
test('renders the label correctly', () => {
|
||||
|
@ -32,5 +32,14 @@ describe('VLink', () => {
|
|||
expect(button.attributes('aria-disabled')).toBe('true');
|
||||
});
|
||||
|
||||
|
||||
test('prevents click when disabled', async () => {
|
||||
const clickHandler = vi.fn();
|
||||
const wrapper = mount(VLink, {
|
||||
props: {label: 'Disabled', disabled: true, onClick: clickHandler}
|
||||
})
|
||||
|
||||
await wrapper.trigger('click')
|
||||
expect(clickHandler).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user