✅ test: Added displaying label test
This commit is contained in:
parent
584cf4ea23
commit
13dd052554
24
test/VLink.spec.ts
Normal file
24
test/VLink.spec.ts
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
import { mount } from '@vue/test-utils'
|
||||||
|
import VLink from '../src/components/button/VLink.vue'
|
||||||
|
import {test, expect, describe} from 'vitest'
|
||||||
|
|
||||||
|
describe('VLink', () => {
|
||||||
|
test('renders the label correctly', () => {
|
||||||
|
const wrapper = mount(VLink, {
|
||||||
|
props: {
|
||||||
|
label: 'Link'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
expect(wrapper.text()).toContain('Link');
|
||||||
|
})
|
||||||
|
|
||||||
|
test('renders as an anchor tag when `href` is provided', () => {
|
||||||
|
const wrapper = mount(VLink, {
|
||||||
|
props: {label: 'External', href: 'https://example.com' }
|
||||||
|
});
|
||||||
|
|
||||||
|
const a = wrapper.find('a')
|
||||||
|
expect(a.exists()).toBe(true);
|
||||||
|
expect(a.attributes('href')).toBe('https://example.com');
|
||||||
|
})
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user