67 lines
2.4 KiB
HTML
67 lines
2.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>简单测试</title>
|
|
</head>
|
|
<body>
|
|
<h1>JavaScript 语法测试</h1>
|
|
<div id="output"></div>
|
|
|
|
<script src="data-models.js"></script>
|
|
<script src="file-manager.js"></script>
|
|
<script src="code-generator.js"></script>
|
|
|
|
<script>
|
|
function runTest() {
|
|
var output = document.getElementById('output');
|
|
var results = [];
|
|
|
|
try {
|
|
// 测试数据模型
|
|
var step = new ProcessStep();
|
|
var action = new ProcessStepDescription();
|
|
var target = new TargetObjectConfig();
|
|
results.push('✅ 数据模型创建成功');
|
|
|
|
// 测试工具函数
|
|
var newStep = DataUtils.createNewStep();
|
|
var validation = DataUtils.validateStep(newStep);
|
|
results.push('✅ DataUtils 工具函数正常');
|
|
|
|
// 测试文件管理器
|
|
var fileManager = new FileManager();
|
|
var fileNames = fileManager.getFileNames();
|
|
results.push('✅ FileManager 创建成功,文件数量: ' + fileNames.length);
|
|
|
|
// 测试代码生成器
|
|
var codeGenerator = new CodeGenerator();
|
|
results.push('✅ CodeGenerator 创建成功');
|
|
|
|
// 测试代码生成
|
|
step.StepDescription = '测试步骤';
|
|
action.Title = '测试动作';
|
|
action.TargetObjects = [target];
|
|
target.ObjectName = '测试对象';
|
|
step.Actions = [action];
|
|
|
|
var code = codeGenerator.generateProcessEventsCode('测试.json', [step]);
|
|
results.push('✅ 代码生成成功,长度: ' + code.length);
|
|
|
|
results.push('<br><strong>所有测试通过!</strong>');
|
|
|
|
} catch (error) {
|
|
results.push('❌ 测试失败: ' + error.message);
|
|
console.error(error);
|
|
}
|
|
|
|
output.innerHTML = results.join('<br>');
|
|
}
|
|
|
|
// 页面加载后运行测试
|
|
window.onload = runTest;
|
|
</script>
|
|
</body>
|
|
</html>
|