state/test/index.html

53 lines
1.9 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<title>State.js Synchronous Tests</title>
<!-- 同步加载重组后的源码文件 (非 ESM 模式) -->
<script src="../src/utils.js"></script>
<script src="../src/reactive.js"></script>
<script src="../src/engine.js"></script>
<script src="../src/index.js" type="module"></script> <!-- Vite dev server entry -->
<!-- 加载所有测试脚本 -->
<script src="./core.test.js"></script>
<script src="./observer.test.js"></script>
<script src="./dom.test.js"></script>
<script src="./component.test.js"></script>
<script src="./priority.test.js"></script>
<script src="./inheritance.test.js"></script>
<script src="./merging.test.js"></script>
<script src="./timing.test.js"></script>
<script src="./foundation.test.js"></script>
</head>
<body>
<div id="results">Running tests...</div>
<script>
window.__DEBUG = false;
async function runAll() {
const results = document.getElementById('results');
try {
// 按顺序执行所有同步加载的测试函数
await testFoundation();
await testTiming();
await testInheritance();
await testCore();
await testObserver();
await testDom();
await testComponent();
await testPriority();
await testMerging();
results.innerHTML = '<h1 style="color: green">All Tests Passed!</h1>';
window.testStatus = 'passed';
} catch (e) {
console.error(e);
results.innerHTML = '<h1 style="color: red">Tests Failed: ' + e.message + '</h1>';
window.testStatus = 'failed';
}
}
// 等待所有内容(包括异步插入的模板)准备就绪
window.addEventListener('load', runAll);
</script>
</body>
</html>