mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-27 00:17:29 +00:00
Canvas Host: build default status with DOM nodes (#58266)
This commit is contained in:
@@ -145,6 +145,8 @@ describe("canvas host", () => {
|
|||||||
expect(html).toContain("Interactive test page");
|
expect(html).toContain("Interactive test page");
|
||||||
expect(html).toContain("openclawSendUserAction");
|
expect(html).toContain("openclawSendUserAction");
|
||||||
expect(html).toContain(CANVAS_WS_PATH);
|
expect(html).toContain(CANVAS_WS_PATH);
|
||||||
|
expect(html).toContain('document.createElement("span")');
|
||||||
|
expect(html).not.toContain("statusEl.innerHTML");
|
||||||
} finally {
|
} finally {
|
||||||
await server.close();
|
await server.close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,11 +121,18 @@ function defaultIndexHTML() {
|
|||||||
typeof window.openclawCanvasA2UIAction.postMessage === "function")
|
typeof window.openclawCanvasA2UIAction.postMessage === "function")
|
||||||
);
|
);
|
||||||
const hasHelper = () => typeof window.openclawSendUserAction === "function";
|
const hasHelper = () => typeof window.openclawSendUserAction === "function";
|
||||||
statusEl.innerHTML =
|
const helperReady = hasHelper();
|
||||||
"Bridge: " +
|
statusEl.textContent = "";
|
||||||
(hasHelper() ? "<span class='ok'>ready</span>" : "<span class='bad'>missing</span>") +
|
statusEl.appendChild(document.createTextNode("Bridge: "));
|
||||||
" · iOS=" + (hasIOS() ? "yes" : "no") +
|
const bridgeStatus = document.createElement("span");
|
||||||
" · Android=" + (hasAndroid() ? "yes" : "no");
|
bridgeStatus.className = helperReady ? "ok" : "bad";
|
||||||
|
bridgeStatus.textContent = helperReady ? "ready" : "missing";
|
||||||
|
statusEl.appendChild(bridgeStatus);
|
||||||
|
statusEl.appendChild(
|
||||||
|
document.createTextNode(
|
||||||
|
" · iOS=" + (hasIOS() ? "yes" : "no") + " · Android=" + (hasAndroid() ? "yes" : "no"),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
const onStatus = (ev) => {
|
const onStatus = (ev) => {
|
||||||
const d = ev && ev.detail || {};
|
const d = ev && ev.detail || {};
|
||||||
|
|||||||
Reference in New Issue
Block a user