import { mount } from '@vue/test-utils'; import { asyncExpect } from '../../../tests/utils'; import Popover from '..'; import mountTest from '../../../tests/shared/mountTest'; describe('Popover', () => { mountTest({ render() { return (
); }, }); it('should show overlay when trigger is clicked', async () => { const popover = mount( { render() { return ( show me your code ); }, }, { sync: false }, ); await asyncExpect(() => { expect(popover.vm.$refs.popover.getPopupDomNode()).toBe(null); popover.find('span').trigger('click'); }, 0); let popup = null; await asyncExpect(() => { popup = popover.vm.$refs.popover.getPopupDomNode(); expect(popup).not.toBe(null); }, 1000); await asyncExpect(() => { expect(popup.innerHTML).toMatchSnapshot(); expect(popup.innerHTML).toMatchSnapshot(); }); }); });