fix: retain Symcon webhook registration and show configured view title
This commit is contained in:
1 parent
8845efdc23
commit
510aece983
14 files changed
+145
-44
No files matched your search
@@ -4,15 +4,22 @@ import { SymconBridge } from "./symcon-bridge.ts";
|
||||
import { entityOptions } from "./components/editor/entities.ts";
|
||||
import { areaEntities } from "./entities/registry.ts";
|
||||
|
||||
function mockWindow(context: TestContext): void {
|
||||
function mockWindow(context: TestContext, title?: string): void {
|
||||
const previous = Object.getOwnPropertyDescriptor(globalThis, "window");
|
||||
Object.defineProperty(globalThis, "window", { configurable: true, value: { __NEXTFLOOR_SYMCON__: { endpoint: "/hook/test", token: "fixture" } } });
|
||||
Object.defineProperty(globalThis, "window", { configurable: true, value: { __NEXTFLOOR_SYMCON__: { endpoint: "/hook/test", token: "fixture", title } } });
|
||||
context.after(() => {
|
||||
if (previous) Object.defineProperty(globalThis, "window", previous);
|
||||
else Reflect.deleteProperty(globalThis, "window");
|
||||
});
|
||||
}
|
||||
|
||||
test("configured view names are exposed to the header with a safe empty-name fallback", (context) => {
|
||||
mockWindow(context, " Haus & Büro <West> ");
|
||||
assert.equal(new SymconBridge().snapshot().symconTitle, "Haus & Büro <West>");
|
||||
window.__NEXTFLOOR_SYMCON__!.title = " ";
|
||||
assert.equal(new SymconBridge().snapshot().symconTitle, "NextFloor");
|
||||
});
|
||||
|
||||
test("numeric control roles stay selectable in the real tree without duplicating automatic device lists", async (context) => {
|
||||
mockWindow(context);
|
||||
context.mock.method(globalThis, "fetch", async () => new Response(JSON.stringify({ state_revision: 1, building_revision: 1, areas: [{ area_id: "room", name: "Raum" }],
|
||||
|
||||
Reference in new issue
Block a user