import { h, Fragment, render, mount, ref, nextTick } from '@/index'; const testChangeFiveRef = ref void)>(null); const testChangeSixRef = ref void)>(null); const Root = mount(function (r) { let showFive = true; let showSix = true; const toggleFive = () => { showFive = !showFive; r(); }; const toggleSix = () => { showSix = !showSix; r(); }; testChangeFiveRef.value = () => { showFive = !showFive; r(); }; testChangeSixRef.value = () => { showSix = !showSix; r(); }; return () => (
  • 4
  • {showFive ?
  • 5
  • : null} {showSix ?
  • 6
  • : null}
  • 7
  • ); }); document.body.innerHTML = ``; const testWrap = document.getElementById('root') as HTMLElement; render(, testWrap, document.getElementById('next')); if (import.meta.vitest) { const { it, expect } = import.meta.vitest; it("Test that 'Lithent' can correctly handle virtual DOM elements when real and virtual DOM elements are mixed under one parent.", () => { expect(testWrap.outerHTML).toBe( '
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 9
    ' ); }); it('The toggle button should remove only the 5.', () => { if (testChangeFiveRef.value && testChangeSixRef.value) { testChangeFiveRef.value(); } nextTick().then(() => { expect(testWrap.outerHTML).toBe( '
    • 1
    • 2
    • 3
    • 4
    • 6
    • 7
    • 9
    ' ); }); }); it('The toggle button should remove only the 6.', () => { if (testChangeFiveRef.value && testChangeSixRef.value) { testChangeSixRef.value(); } nextTick().then(() => { expect(testWrap.outerHTML).toBe( '
    • 1
    • 2
    • 3
    • 4
    • 7
    • 9
    ' ); }); }); }