推进 INI 面板 launch entry
This commit is contained in:
48
wasm-port/tests/browser/ini_panel_launch_smoke.html
Normal file
48
wasm-port/tests/browser/ini_panel_launch_smoke.html
Normal file
@@ -0,0 +1,48 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>LinuxCNC INI Launch Smoke</title>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="status">running</pre>
|
||||
<script type="module">
|
||||
function assertEqual(actual, expected, label) {
|
||||
if (actual !== expected) {
|
||||
throw new Error(`${label}: expected ${expected}, got ${actual}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function loadLaunchFrame() {
|
||||
const frame = document.createElement("iframe");
|
||||
frame.src = "../../runtime/ui/ini-panel/launch.html";
|
||||
document.body.appendChild(frame);
|
||||
await new Promise((resolve, reject) => {
|
||||
frame.addEventListener("load", resolve, { once: true });
|
||||
frame.addEventListener("error", reject, { once: true });
|
||||
});
|
||||
return frame.contentDocument;
|
||||
}
|
||||
|
||||
try {
|
||||
const launchDoc = await loadLaunchFrame();
|
||||
assertEqual(
|
||||
launchDoc.querySelector('a[href="./index.html"]').textContent,
|
||||
"Open edit and run panel",
|
||||
"launch panel edit link",
|
||||
);
|
||||
assertEqual(
|
||||
launchDoc.querySelector('a[href="./control-page.html"]').textContent,
|
||||
"Open read-only control view",
|
||||
"launch panel control link",
|
||||
);
|
||||
status.textContent = "browser_ini_launch_smoke=ok";
|
||||
console.log("browser_ini_launch_smoke=ok");
|
||||
} catch (error) {
|
||||
status.textContent = `browser_ini_launch_smoke=failed: ${error.message}`;
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user