import { afterEach, describe, expect, it } from 'vitest' import { mount } from '@vue/test-utils' import BaseModal from '../BaseModal.vue' describe('BaseModal', () => { afterEach(() => { document.body.style.overflow = '' }) it('locks page scroll while open and restores it when closed', async () => { const wrapper = mount(BaseModal, { props: { show: true, title: 'Test modal' }, slots: { default: '

Modal content

' }, attachTo: document.body, }) expect(document.body.style.overflow).toBe('hidden') await wrapper.setProps({ show: false }) expect(document.body.style.overflow).toBe('') wrapper.unmount() }) })