diff --git a/test/VLink.spec.ts b/test/VLink.spec.ts index fc91dce..838ced8 100644 --- a/test/VLink.spec.ts +++ b/test/VLink.spec.ts @@ -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(); + }); + })