Add component tests for presentational components and Login
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
29
tests/components/Button.test.js
Normal file
29
tests/components/Button.test.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { mount } from '@vue/test-utils';
|
||||
import Button from '@/components/Button.vue';
|
||||
|
||||
describe('Button', () => {
|
||||
it('renders button text', () => {
|
||||
const wrapper = mount(Button, {
|
||||
props: { buttonText: 'Click Me' },
|
||||
});
|
||||
expect(wrapper.text()).toBe('Click Me');
|
||||
});
|
||||
|
||||
it('adds ring classes on mousedown', async () => {
|
||||
const wrapper = mount(Button, {
|
||||
props: { buttonText: 'Test' },
|
||||
});
|
||||
await wrapper.trigger('mousedown');
|
||||
expect(wrapper.classes()).toContain('ring');
|
||||
});
|
||||
|
||||
it('removes ring classes on mouseup', async () => {
|
||||
const wrapper = mount(Button, {
|
||||
props: { buttonText: 'Test' },
|
||||
});
|
||||
await wrapper.trigger('mousedown');
|
||||
await wrapper.trigger('mouseup');
|
||||
expect(wrapper.classes()).not.toContain('ring');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user