import { UModalActions } from './UModalActions' import { describe, it, expect, vitest } from 'vitest' import { mount } from '@vue/test-utils' describe('UModalActions', () => { it('should render correctly', () => { const wrapper = mount(UModalActions) expect(wrapper.html()).toMatchSnapshot() }) it('should render dual actions modal correctly', async () => { const wrapper = mount(UModalActions, { props: { dualActions: true, isActive: true, }, }) const buttons = wrapper.findAllComponents({ name: 'UButton' }) expect(buttons.length).toBe(2) expect(wrapper.html()).toMatchSnapshot() }) it('should render modal with dual actions and small actions prop correctly', async () => { const wrapper = mount(UModalActions, { props: { dualActions: true, isActive: true, smallActions: true, }, }) const buttons = wrapper.findAllComponents({ name: 'UButton' }) expect(buttons.length).toBe(2) expect(wrapper.html()).toMatchSnapshot() }) it('should render modal with checkbox correctly', async () => { const wrapper = mount(UModalActions, { props: { isActive: true, checkboxControl: true, }, }) const checkbox = wrapper.findComponent({ name: 'UCheckbox' }) expect(checkbox.exists()).toBe(true) expect(wrapper.html()).toMatchSnapshot() await checkbox.trigger('click') //проверить вызов функции onCheck и пропс checked: /* const onCheckSpy = vitest.spyOn(wrapper.vm, 'onCheck') await checkbox.trigger('click') expect(onCheckSpy).toHaveBeenCalled() expect(wrapper.vm.checked).toBe(true) */ }) })