diff --git a/packages/components/label/tests/__snapshots__/label.test.ts.snap b/packages/components/label/tests/__snapshots__/label.test.ts.snap index 7a6681e33..9b4902602 100644 --- a/packages/components/label/tests/__snapshots__/label.test.ts.snap +++ b/packages/components/label/tests/__snapshots__/label.test.ts.snap @@ -1,5 +1,9 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`okuLabel > should render OkuLabel correctly 1`] = `""`; + +exports[`okuLabel > should render OkuLabel correctly 2`] = `""`; + exports[`okuLabel Stories > styled > should render correctly 1`] = `""`; exports[`okuLabel Stories > withControl > should render correctly 1`] = ` diff --git a/packages/components/label/tests/label.test.ts b/packages/components/label/tests/label.test.ts index 90772c8e0..05097a504 100644 --- a/packages/components/label/tests/label.test.ts +++ b/packages/components/label/tests/label.test.ts @@ -1,4 +1,4 @@ -import { enableAutoUnmount, shallowMount } from '@vue/test-utils' +import { enableAutoUnmount, mount, shallowMount } from '@vue/test-utils' import type { VueWrapper } from '@vue/test-utils' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { axe } from 'vitest-axe' @@ -10,19 +10,23 @@ import WithControl from '../src/stories/WithControl.vue' enableAutoUnmount(afterEach) -describe.skip('okuLabel', () => { +describe('okuLabel', () => { let wrapper: VueWrapper + const onMousedown = vi.fn() + beforeEach(() => { wrapper = shallowMount({ components: { OkuLabel, }, setup() { - return { } + return { + onMousedown, + } }, template: ` - + Label `, @@ -44,17 +48,16 @@ describe.skip('okuLabel', () => { expect(await axe(wrapper.element)).toHaveNoViolations() }) + // TODO: mock preventDefault() it('should prevent default on double click', async () => { - const event = { - preventDefault: vi.fn(), - detail: 2, - } - - await wrapper.trigger('mousedown', event) + await wrapper.trigger('mousedown') + await wrapper.trigger('mousedown') expect(wrapper.emitted('mousedown')).toBeTruthy() + }) - expect(event.preventDefault).toHaveBeenCalled() + it('should call `onMousedown` event', () => { + expect(onMousedown).toHaveBeenCalled() }) })