import assert from "node:assert/strict"; import test from "node:test"; import { createRenderer, createSSRApp, nextTick } from "vue"; import { renderToString } from "@vue/server-renderer"; import { parseSkinPluginDocument, type SkinPluginDocument } from "../../../src/shared/skin-plugin.js"; import { approveSkinPluginComponents } from "./skin-plugin-approval.js"; import { parseSkinExtensionUiActionRequest, parseSkinExtensionUiOutput, SKIN_EXTENSION_UI_OUTPUT_LIMIT_BYTES, SkinExtensionUiOutputError, } from "../../../src/shared/skin-extension-ui.js"; import SkinPluginOutlet from "../components/SkinPluginOutlet.js"; function outputDocument(componentId = "runtime-ui", root?: Record, permissions: string[] = [], actions: Record = {}, state?: Record): string { return JSON.stringify({ schemaVersion: 3, components: [{ id: componentId, name: "Runtime UI", page: "voice", accessibleName: "Runtime UI", permissions, actions, ...(state ? { state } : {}), root: root ?? { tag: "section", children: [{ text: "Generated by Wasm" }] }, }], }); } function generatedOutput(componentId = "runtime-ui", root: Record = { tag: "main", children: [{ text: "Generated by Wasm" }] }): string { return JSON.stringify({ schemaVersion: 4, components: [{ id: componentId, name: "Runtime UI", page: "voice", accessibleName: "Runtime UI", root }], }); } function expectOutputError(source: string, code: string): void { assert.throws(() => parseSkinExtensionUiOutput(source), (error: unknown) => error instanceof SkinExtensionUiOutputError && error.code === code); } test("Wasm UI output uses the v3 schema and supports local-only interaction", () => { const document = parseSkinExtensionUiOutput(outputDocument("runtime-ui", { tag: "section", children: [ { tag: "button", attributes: { type: "button" }, events: { click: "toggle" }, children: [{ text: "Toggle" }] }, { tag: "p", when: { path: "state.open", equals: true }, children: [{ text: "Expanded" }] }, ], }, [], { toggle: { type: "ui.toggleState", args: { key: "open" } } }, { open: false })); assert.equal(document.schemaVersion, 3); assert.equal(document.components[0].actions.toggle.type, "ui.toggleState"); }); test("Wasm UI output rejects malformed, oversized, legacy, and capability-bearing documents", () => { expectOutputError("{", "SKIN_EXTENSION_UI_OUTPUT_JSON"); expectOutputError(" ".repeat(SKIN_EXTENSION_UI_OUTPUT_LIMIT_BYTES + 1), "SKIN_EXTENSION_UI_OUTPUT_SIZE"); expectOutputError(JSON.stringify({ schemaVersion: 2, components: [{ id: "runtime-ui", name: "Runtime UI", page: "voice", accessibleName: "Runtime UI", permissions: [], actions: {}, root: { tag: "section" }, }] }), "SKIN_EXTENSION_UI_SCHEMA_UNSUPPORTED"); expectOutputError(outputDocument("runtime-ui", undefined, ["session.status.read"]), "SKIN_EXTENSION_UI_CAPABILITY_UNSUPPORTED"); expectOutputError(outputDocument("runtime-ui", undefined, [], { disconnect: { type: "voice.disconnect", args: {} } }), "SKIN_EXTENSION_UI_OUTPUT_SCHEMA"); expectOutputError(outputDocument("runtime-ui", { widget: "voice.audio-controls" }), "SKIN_EXTENSION_UI_WIDGET_UNSUPPORTED"); expectOutputError(outputDocument("runtime-ui", { tag: "p", text: "{{session.status.channelName}}" }), "SKIN_EXTENSION_UI_OUTPUT_SCHEMA"); }); test("generated UI supports broad safe markup, ARIA/data attributes, and inert custom-element placeholders", () => { const document = parseSkinExtensionUiOutput(generatedOutput("kook-rail", { tag: "kook-server-rail", attributes: { "aria-label": "Servers", "data-selected": "home", role: "navigation" }, children: [ { tag: "a", attributes: { href: "#voice" }, children: [{ text: "Voice" }] }, { tag: "button", attributes: { type: "button", "aria-pressed": true }, children: [{ text: "Home" }] }, ], })); assert.equal(document.schemaVersion, 3); assert.equal(document.components[0].root.tag, "kook-server-rail"); assert.equal(document.components[0].root.children?.[0].tag, "a"); assert.equal(document.components[0].root.children?.[1].tag, "button"); }); test("generated UI supports standard elements and attributes without a fixed presentation allowlist", () => { const document = parseSkinExtensionUiOutput(generatedOutput("custom-layout", { tag: "dialog", attributes: { open: true, inert: true, "aria-roledescription": "voice panel", "data-layout-state": "expanded" }, children: [{ tag: "menu", attributes: { type: "toolbar", "aria-label": "Voice tools" }, children: [{ tag: "picture" }] }], })); assert.equal(document.components[0].root.tag, "dialog"); assert.equal(document.components[0].root.attributes?.inert, true); assert.equal(document.components[0].root.children?.[0].tag, "menu"); assert.equal(document.components[0].root.children?.[0].children?.[0].tag, "picture"); }); test("generated SVG restores case-sensitive standard attribute names in host-rendered markup", async () => { const html = await renderToString(createSSRApp(SkinPluginOutlet, { skinId: "community.test", skinVersion: "1.0.0", document: { schemaVersion: 3, components: [] }, extensionOutput: generatedOutput("svg-ui", { tag: "svg", attributes: { viewbox: "0 0 24 24", preserveaspectratio: "xMidYMid meet" }, children: [{ tag: "linearGradient", attributes: { id: "paint", gradientunits: "userSpaceOnUse" } }], }), page: "voice", data: {}, assets: {}, actions: {}, })); assert.match(html, /viewBox="0 0 24 24"/); assert.match(html, /preserveAspectRatio="xMidYMid meet"/); assert.match(html, /gradientUnits="userSpaceOnUse"/); }); test("generated UI can exceed the former 16 KiB output ceiling while staying within the new package-sized limit", () => { const source = JSON.stringify({ schemaVersion: 4, components: [{ id: "expanded-ui", name: "Expanded UI", page: "voice", accessibleName: "Expanded UI", root: { tag: "main", children: Array.from({ length: 4 }, () => ({ text: "x".repeat(7_000) })) }, }], }); assert.ok(new TextEncoder().encode(source).byteLength > 16 * 1024); assert.ok(parseSkinExtensionUiOutput(source).components.length === 1); }); test("generated screen-share host widget requires permission and renders as an interactive host control", async () => { const source = generatedOutput("share-control", { tag: "section", children: [{ widget: "voice.screen-share-start", part: "start-share" }], }); expectOutputError(source, "SKIN_EXTENSION_UI_PERMISSION_MISSING"); const permissions = ["voice.screenShare.control"] as const; const document = parseSkinExtensionUiOutput(source, { permissions }); assert.equal(document.components[0].root.children?.[0].widget, "voice.screen-share-start"); const html = await renderToString(createSSRApp(SkinPluginOutlet, { skinId: "community.test", skinVersion: "1.0.0", document: { schemaVersion: 3, components: [] }, extensionOutput: source, extensionPermissions: permissions, page: "voice", data: {}, assets: {}, actions: {}, widgets: { "voice.screen-share-start": () => "Start screen share" }, })); assert.match(html, /data-ws-plugin-widget="voice\.screen-share-start"/); assert.match(html, /data-ws-part="skin\.voice\.share-control\.control-part-start-share"/); assert.match(html, /Start screen share/); }); test("generated UI schema 5 carries bounded state and named callbacks for a trusted host event loop", () => { const source = JSON.stringify({ schemaVersion: 5, components: [{ id: "server-rail", name: "Server rail", page: "voice", accessibleName: "Saved voice servers", state: { expanded: false, selected: "home" }, root: { tag: "nav", children: [{ tag: "button", attributes: { type: "button", "aria-pressed": false }, events: { click: "select-server" }, children: [{ text: "Home" }], }], }, }], }); const document = parseSkinExtensionUiOutput(source); const component = document.components[0]; assert.equal(component.runtimeCallbacks, true); assert.deepEqual({ ...component.state }, { expanded: false, selected: "home" }); assert.equal(component.root.children?.[0].events?.click, "select-server"); }); test("generated UI schema 6 validates one host action against plugin permissions", () => { const source = JSON.stringify({ schemaVersion: 6, components: [{ id: "voice-channels", name: "Voice channels", page: "voice", accessibleName: "Voice channels", state: {}, root: { tag: "button", events: { dblclick: "join" }, children: [{ text: "Join" }] }, }], request: { type: "voice.joinChannel", args: { channelId: "channel-1" } }, }); const document = parseSkinExtensionUiOutput(source); assert.equal(document.components[0].runtimeCallbacks, true); const action = parseSkinExtensionUiActionRequest(source, ["session.channel.join"]); assert.deepEqual(action && { type: action.type, args: { ...action.args } }, { type: "voice.joinChannel", args: { channelId: "channel-1" }, }); assert.throws(() => parseSkinExtensionUiActionRequest(source, []), (error: unknown) => error instanceof SkinExtensionUiOutputError && error.code === "SKIN_EXTENSION_UI_ACTION_INVALID"); expectOutputError(JSON.stringify({ schemaVersion: 6, components: [{ id: "voice-channels", name: "Voice channels", page: "voice", accessibleName: "Voice channels", root: { tag: "main" } }], request: { type: "voice.joinChannel", args: { channelId: "channel-1", address: "private.example" } }, }), "SKIN_EXTENSION_UI_ACTION_INVALID"); }); test("generated UI callbacks reject unsupported events, malformed IDs, and password inputs", () => { const schema5 = (root: Record) => JSON.stringify({ schemaVersion: 5, components: [{ id: "runtime-ui", name: "Runtime UI", page: "voice", accessibleName: "Runtime UI", root }], }); expectOutputError(schema5({ tag: "button", events: { animationstart: "run" } }), "SKIN_EXTENSION_UI_OUTPUT_SCHEMA"); expectOutputError(schema5({ tag: "button", events: { click: "../run" } }), "SKIN_EXTENSION_UI_OUTPUT_SCHEMA"); expectOutputError(schema5({ tag: "input", attributes: { type: "password" } }), "SKIN_EXTENSION_UI_ATTRIBUTE_INVALID"); expectOutputError(generatedOutput("runtime-ui", { tag: "button", events: { click: "run" } }), "SKIN_EXTENSION_UI_OUTPUT_SCHEMA"); }); test("SkinPluginOutlet emits only trusted callbacks and gates user-entered values by permission", async () => { interface HostNode { type: string; props: Record; text: string; children: HostNode[]; parent?: HostNode; } const createHostNode = (type: string, text = ""): HostNode => ({ type, props: {}, text, children: [] }); const renderer = createRenderer({ patchProp(node, key, _previous, next) { node.props[key] = next; }, insert(node, parent, anchor) { node.parent = parent; const oldIndex = parent.children.indexOf(node); if (oldIndex >= 0) parent.children.splice(oldIndex, 1); const anchorIndex = anchor ? parent.children.indexOf(anchor) : -1; parent.children.splice(anchorIndex >= 0 ? anchorIndex : parent.children.length, 0, node); }, remove(node) { const parent = node.parent; if (!parent) return; const index = parent.children.indexOf(node); if (index >= 0) parent.children.splice(index, 1); node.parent = undefined; }, createElement: (type) => createHostNode(type), createText: (text) => createHostNode("#text", text), createComment: (text) => createHostNode("#comment", text), setText(node, text) { node.text = text; }, setElementText(node, text) { node.children = []; node.text = text; }, parentNode: (node) => node.parent ?? null, nextSibling(node) { if (!node.parent) return null; const index = node.parent.children.indexOf(node); return node.parent.children[index + 1] ?? null; }, }); const document: SkinPluginDocument = { schemaVersion: 3, components: [{ id: "base", name: "Base", page: "voice", accessibleName: "Base", permissions: [], actions: {}, root: { tag: "p", children: [{ text: "Base" }] }, }], }; const output = JSON.stringify({ schemaVersion: 5, components: [{ id: "server-rail", name: "Server rail", page: "voice", accessibleName: "Saved voice servers", state: { expanded: false }, root: { tag: "div", children: [ { tag: "button", attributes: { type: "button" }, events: { click: "select-server" }, children: [{ text: "Home" }] }, { tag: "input", attributes: { type: "text" }, events: { input: "search" } }, ] }, }], }); class MockInputElement { type = "text"; value = "private search text"; checked = false; } const previousInputConstructor = Object.getOwnPropertyDescriptor(globalThis, "HTMLInputElement"); Object.defineProperty(globalThis, "HTMLInputElement", { configurable: true, value: MockInputElement }); const find = (node: HostNode, type: string): HostNode | undefined => node.type === type ? node : node.children.map((child) => find(child, type)).find(Boolean); const runInput = async (permissions: string[]) => { const emitted: unknown[] = []; const host = createHostNode("root"); const app = renderer.createApp(SkinPluginOutlet, { skinId: "community.test", skinVersion: "1.0.0", document, extensionOutput: output, extensionPermissions: permissions, page: "voice", data: {}, assets: {}, actions: {}, "onExtension-event": (payload: unknown) => emitted.push(payload), }); app.mount(host); await nextTick(); const input = find(host, "input"); assert.ok(input); (input.props.onInput as (event: Event) => void)({ isTrusted: true, target: new MockInputElement() } as unknown as Event); app.unmount(); return emitted[0] as { input: { event: Record } }; }; try { const deniedHost = createHostNode("root"); const deniedEvents: unknown[] = []; const deniedApp = renderer.createApp(SkinPluginOutlet, { skinId: "community.test", skinVersion: "1.0.0", document, extensionOutput: output, page: "voice", data: {}, assets: {}, actions: {}, "onExtension-event": (payload: unknown) => deniedEvents.push(payload), }); deniedApp.mount(deniedHost); await nextTick(); const button = find(deniedHost, "button"); const input = find(deniedHost, "input"); assert.ok(button && input); const onClick = button.props.onClick as (event: Event) => void; onClick({ isTrusted: false, target: null } as unknown as Event); assert.equal(deniedEvents.length, 0, "script-created events must not reach extension logic"); onClick({ isTrusted: true, target: null } as unknown as Event); const deniedValueEvent = input.props.onInput as (event: Event) => void; deniedValueEvent({ isTrusted: true, target: new MockInputElement() } as unknown as Event); const clickPayload = deniedEvents[0] as { skinId: string; componentId: string; input: { state: Record; event: Record } }; assert.equal(clickPayload.skinId, "community.test"); assert.equal(clickPayload.componentId, "server-rail"); assert.deepEqual({ ...clickPayload.input.state }, { expanded: false }); assert.deepEqual(clickPayload.input.event, { componentId: "server-rail", handlerId: "select-server", eventName: "click" }); const deniedValuePayload = deniedEvents[1] as { input: { event: Record } }; assert.deepEqual(deniedValuePayload.input.event, { componentId: "server-rail", handlerId: "search", eventName: "input" }); deniedApp.unmount(); const approvedValuePayload = await runInput(["ui.input.read"]); assert.deepEqual(approvedValuePayload.input.event, { componentId: "server-rail", handlerId: "search", eventName: "input", value: "private search text", }); } finally { if (previousInputConstructor) Object.defineProperty(globalThis, "HTMLInputElement", previousInputConstructor); else Reflect.deleteProperty(globalThis, "HTMLInputElement"); } }); test("generated UI rejects executable elements, event handlers, and network/navigation sinks", () => { expectOutputError(generatedOutput("runtime-ui", { tag: "script" }), "SKIN_EXTENSION_UI_ELEMENT_INVALID"); expectOutputError(generatedOutput("runtime-ui", { tag: "iframe" }), "SKIN_EXTENSION_UI_ELEMENT_INVALID"); expectOutputError(generatedOutput("runtime-ui", { tag: "button", attributes: { onclick: "run" } }), "SKIN_EXTENSION_UI_ATTRIBUTE_INVALID"); expectOutputError(generatedOutput("runtime-ui", { tag: "img", attributes: { src: "https://example.invalid/a.png" } }), "SKIN_EXTENSION_UI_ATTRIBUTE_INVALID"); expectOutputError(generatedOutput("runtime-ui", { tag: "a", attributes: { href: "https://example.invalid/" } }), "SKIN_EXTENSION_UI_ATTRIBUTE_INVALID"); expectOutputError(generatedOutput("runtime-ui", { tag: "div", attributes: { style: "display:none" } }), "SKIN_EXTENSION_UI_ATTRIBUTE_INVALID"); expectOutputError(generatedOutput("runtime-ui", { tag: "div", attributes: { "bad name": "value" } }), "SKIN_EXTENSION_UI_ATTRIBUTE_INVALID"); expectOutputError(generatedOutput("runtime-ui", { tag: "div", attributes: { Onclick: "run" } }), "SKIN_EXTENSION_UI_ATTRIBUTE_INVALID"); expectOutputError(generatedOutput("runtime-ui", { tag: "div", attributes: { "data-ws-part": "spoofed" } }), "SKIN_EXTENSION_UI_ATTRIBUTE_INVALID"); }); test("generated UI cannot create browser top-layer popovers that cover host controls", () => { expectOutputError(generatedOutput("runtime-ui", { tag: "div", attributes: { popover: "manual" } }), "SKIN_EXTENSION_UI_ATTRIBUTE_INVALID"); expectOutputError(generatedOutput("runtime-ui", { tag: "button", attributes: { popovertarget: "host-editor" } }), "SKIN_EXTENSION_UI_ATTRIBUTE_INVALID"); expectOutputError(generatedOutput("runtime-ui", { tag: "button", attributes: { popovertargetaction: "show" } }), "SKIN_EXTENSION_UI_ATTRIBUTE_INVALID"); }); test("generated UI enforces component and per-node child limits", () => { const tooManyComponents = JSON.stringify({ schemaVersion: 4, components: Array.from({ length: 65 }, (_, index) => ({ id: `runtime-${index}`, name: "Runtime UI", page: "voice", accessibleName: "Runtime UI", root: { tag: "main" }, })), }); const tooManyChildren = generatedOutput("runtime-ui", { tag: "main", children: Array.from({ length: 257 }, () => ({ text: "x" })), }); expectOutputError(tooManyComponents, "SKIN_EXTENSION_UI_OUTPUT_SCHEMA"); expectOutputError(tooManyChildren, "SKIN_EXTENSION_UI_COMPLEXITY_LIMIT"); }); test("SkinPluginOutlet renders validated dynamic output and preserves package UI on collisions", async () => { const document: SkinPluginDocument = { schemaVersion: 3, components: [{ id: "base-ui", name: "Base UI", page: "voice", accessibleName: "Base UI", permissions: [], actions: {}, root: { tag: "p", children: [{ text: "Package UI" }] }, }], }; const props = { skinId: "community.test", skinVersion: "1.0.0", document, page: "voice" as const, data: {}, assets: {}, actions: {}, }; const html = await renderToString(createSSRApp(SkinPluginOutlet, { ...props, extensionOutput: outputDocument("runtime-ui"), })); assert.match(html, /data-ws-plugin-component="base-ui"/); assert.match(html, /data-ws-plugin-component="runtime-ui"/); assert.match(html, /Generated by Wasm/); const collisionHtml = await renderToString(createSSRApp(SkinPluginOutlet, { ...props, extensionOutput: outputDocument("base-ui"), })); assert.match(collisionHtml, /data-ws-plugin-component="base-ui"/); assert.doesNotMatch(collisionHtml, /Generated by Wasm/); assert.match(collisionHtml, /Package UI/); }); test("runtime plugin component layout parts keep plugin and component identities in the layout registry format", async () => { const html = await renderToString(createSSRApp(SkinPluginOutlet, { skinId: "community.test", skinVersion: "1.0.0", document: { schemaVersion: 3, components: [{ id: "base-ui", name: "Base UI", page: "voice", accessibleName: "Base UI", permissions: [], actions: {}, root: { tag: "main", children: [{ text: "Base UI" }] }, }], }, extensionOutput: generatedOutput("voice-ui", { tag: "button", part: "join", children: [{ text: "Join" }] }), componentNamespace: "voice-surface", page: "voice", data: {}, assets: {}, actions: {}, })); assert.match(html, /data-ws-part="skin\.voice\.runtime_plugin_voice-surface__voice-ui"/); assert.match(html, /data-ws-part="skin\.voice\.runtime_plugin_voice-surface__voice-ui\.control-part-join"/); }); test("SkinPluginOutlet renders generated custom elements as inert host nodes", async () => { const document: SkinPluginDocument = { schemaVersion: 3, components: [{ id: "base-ui", name: "Base UI", page: "voice", accessibleName: "Base UI", permissions: [], actions: {}, root: { tag: "p", children: [{ text: "Base" }] }, }], }; const html = await renderToString(createSSRApp(SkinPluginOutlet, { skinId: "community.test", skinVersion: "1.0.0", document, extensionOutput: generatedOutput("kook-rail", { tag: "kook-server-rail", children: [{ text: "Server" }] }), page: "voice", data: {}, assets: {}, actions: {}, })); assert.match(html, /]*data-ws-generated-element="kook-server-rail"/); assert.match(html, /Server/); }); test("SkinPluginOutlet renders bounded members nested under their channel", async () => { const document = { schemaVersion: 3, components: [{ id: "channel-members", name: "Channel members", page: "voice", accessibleName: "Voice channels and members", permissions: ["session.channels.read", "session.members.read"], actions: {}, root: { tag: "nav", repeat: { path: "session.channels", as: "channel" }, children: [{ tag: "section", children: [ { tag: "h2", children: [{ text: "{{channel.name}}" }] }, { tag: "ul", children: [{ tag: "li", repeat: { path: "channel.members", as: "member" }, children: [{ text: "{{member.name}}" }], }], }, ], }], }, }], } as unknown as SkinPluginDocument; const storage = new Map(); const previousStorage = Object.getOwnPropertyDescriptor(globalThis, "localStorage"); Object.defineProperty(globalThis, "localStorage", { configurable: true, value: { getItem: (key: string) => storage.get(key) ?? null, setItem: (key: string, value: string) => { storage.set(key, value); }, }, }); try { approveSkinPluginComponents("community.test", "1.0.0", document.components); const html = await renderToString(createSSRApp(SkinPluginOutlet, { skinId: "community.test", skinVersion: "1.0.0", document, page: "voice", data: { session: { channels: Array.from({ length: 100 }, (_, channelIndex) => ({ id: `room-${channelIndex}`, name: channelIndex === 0 ? "Room One" : `Room ${channelIndex}`, members: Array.from({ length: 100 }, (_, memberIndex) => ({ id: `user-${channelIndex}-${memberIndex}`, name: `Member-${channelIndex}-${memberIndex}` })), })) } }, assets: {}, actions: {}, })); assert.match(html, /Room One/); const renderedMembers = html.match(/Member-\d+-\d+/g) ?? []; assert.ok(renderedMembers.length > 0); assert.ok(renderedMembers.length < 10_000, "nested repeats must stop at the component render-node limit"); } finally { if (previousStorage) Object.defineProperty(globalThis, "localStorage", previousStorage); else Reflect.deleteProperty(globalThis, "localStorage"); } }); test("skin-authored DOM nodes expose independent layout parts and retain touch bounds for controls", async () => { const document: SkinPluginDocument = { schemaVersion: 3, components: [{ id: "voice-toolbar", name: "Voice toolbar", page: "voice", accessibleName: "Voice toolbar", permissions: [], actions: {}, root: { tag: "section", children: [ { tag: "button", part: "disconnect", attributes: { type: "button" }, children: [{ text: "Disconnect" }] }, { text: "Voice tools", part: "caption" }, ], }, }], }; const html = await renderToString(createSSRApp(SkinPluginOutlet, { skinId: "community.test", skinVersion: "1.0.0", document, page: "voice", data: {}, assets: {}, actions: {}, })); assert.match(html, /data-ws-part="skin\.voice\.voice-toolbar"/); assert.match(html, /data-ws-part="skin\.voice\.voice-toolbar\.node-root"/); assert.match(html, /data-ws-part="skin\.voice\.voice-toolbar\.control-part-disconnect"/); assert.match(html, /data-ws-part="skin\.voice\.voice-toolbar\.part-caption"/); }); test("skin nodes cannot impersonate WebSpeak page and layout hooks", async () => { const document = parseSkinPluginDocument({ schemaVersion: 3, components: [{ id: "hook-test", name: "Hook test", page: "voice", accessibleName: "Hook test", permissions: [], actions: {}, root: { tag: "section", children: [{ tag: "div", attributes: { "data-ws-page": "admin", "data-ws-layout-hidden": true, "data-testid": "safe" } }], }, }], }); const html = await renderToString(createSSRApp(SkinPluginOutlet, { skinId: "community.test", skinVersion: "1.0.0", document, page: "voice", data: {}, assets: {}, actions: {}, })); assert.match(html, /data-testid="safe"/); assert.doesNotMatch(html, /data-ws-page="admin"/); assert.doesNotMatch(html, /data-ws-layout-hidden=/); });