import { describe, it, expect } from 'vitest'; import { h, render, mount, nextTick } from '@/index'; import { ref } from '@/hook/ref'; describe('component returns component and remounts correctly', () => { it('re-adds child after being removed', async () => { const toggleRef = ref void)>(null); const Child = () =>
child
; const Wrapper = mount(renew => { let show = true; toggleRef.value = () => { show = !show; renew(); }; return () => (show ? : null); }); const testWrap = document.createElement('div'); render(, testWrap); expect(testWrap.innerHTML).toContain('child'); toggleRef.value?.(); await nextTick(); expect(testWrap.innerHTML).toBe(''); toggleRef.value?.(); await nextTick(); expect(testWrap.innerHTML).toContain('child'); }); });