refactor: route all decoders through plugin runtime
This commit is contained in:
@@ -19,12 +19,14 @@ test("WEFAX entry exposes typed lifecycle handlers and renders decoder state", a
|
||||
Uint8Array,
|
||||
console,
|
||||
});
|
||||
const runtime = await readFile(new URL("../../assets/web/generated/plugin-runtime.js", import.meta.url), "utf8");
|
||||
const source = await readFile(new URL("../../assets/web/generated/wefax.js", import.meta.url), "utf8");
|
||||
new vm.Script(runtime).runInContext(context);
|
||||
new vm.Script(source).runInContext(context);
|
||||
|
||||
assert.equal(typeof window.onServerWefaxProgress, "function");
|
||||
assert.equal(typeof window.restoreWefaxHistory, "function");
|
||||
window.onServerWefaxProgress({ state: "Scanning 12 MHz" });
|
||||
assert.equal(window.onServerWefaxProgress, undefined);
|
||||
assert.equal(window.trxPluginRuntime.hasDecoder("wefax_progress"), true);
|
||||
window.trxPluginRuntime.dispatch("wefax_progress", { state: "Scanning 12 MHz" });
|
||||
assert.equal(status.textContent, "Scanning 12 MHz");
|
||||
assert.equal(status.style.color, "var(--text-accent)");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user