17 lines
1.2 KiB
JavaScript
17 lines
1.2 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { renderDevicePanel } from "./device-panel.mjs";
|
|
import { renderHalPanel } from "./hal-panel.mjs";
|
|
import { renderMachineView } from "./machine-view.mjs";
|
|
|
|
class Node { constructor(tag) { this.tagName = tag; this.children = []; this.textContent = ""; this.className = ""; } append(...nodes) { this.children.push(...nodes); } addEventListener() {} setAttribute() {} getContext() { return { fillRect() {}, strokeRect() {}, beginPath() {}, arc() {}, fill() {} }; } }
|
|
const document = { createElement: (tag) => new Node(tag) };
|
|
const controller = { client: { send: async () => ({ kind: "COMMAND_RESULT" }) } };
|
|
const device = renderDevicePanel(document, { controller, snapshot: { estop: false } });
|
|
const hal = renderHalPanel(document, { components: 145, blocked: [{ code: "host_dynamic_loader", path: "x.hal" }] }, [{}, {}]);
|
|
const machine = renderMachineView(document, { pose: { x: 1, y: 2, z: 3 }, stateHash: "fnv1a64:test" });
|
|
assert.equal(device.className, "panel device-panel");
|
|
assert.equal(hal.className, "panel hal-panel");
|
|
assert.equal(machine.className, "panel machine-panel");
|
|
assert.equal(machine.children[1].tagName, "canvas");
|
|
console.log("frontend_m4=passed panels=3");
|