import { nextTick } from 'vue' import { mount } from '@vue/test-utils' import * as Aria from '@element-plus/utils/aria' const isVisibleMock = jest .spyOn(Aria, 'isVisible') .mockImplementation(() => true) import TrapFocus, { ITrapFocusElement, FOCUSABLE_CHILDREN, } from '../trap-focus' let wrapper const _mount = (template: string) => mount( { template, props: {}, }, { global: { directives: { TrapFocus }, }, attachTo: document.body, }, ) afterAll(() => { isVisibleMock.mockRestore() }) afterEach(() => { wrapper.unmount() }) describe('v-trap-focus', () => { test('should fetch all focusable element', () => { wrapper = _mount(`
`) expect( (wrapper.element as ITrapFocusElement)[FOCUSABLE_CHILDREN].length, ).toBe(1) }) test('should not fetch disabled element', () => { wrapper = _mount(`