// test/timing.test.js window.testTiming = async function() { const { ___unsafeRefreshState, Component, NewState, $, Util } = ApigoState; console.log('Testing initialization timing...'); Component.register('TimingComp', container => { container.state = NewState({ msg: 'Ready' }); }, Util.makeDom(`
`)); document.body.innerHTML += ``; ___unsafeRefreshState(document.documentElement); await new Promise(r => setTimeout(r, 100)); const content = $('#timing-content'); if (!content) throw new Error('Component child failed to render content due to timing'); if (content.textContent !== 'Ready') throw new Error('Child content incorrect'); console.log('Timing tests passed'); return true; }