[web] The web UI: hosts, add/edit with apply progress, undo, history and restore, share links, engine switch, certificates and device installs, signing by hand, settings and tokens; smoke test counts every §4 flow's clicks
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
// jsdom lacks a few browser features the UI uses.
|
||||
|
||||
if (typeof HTMLDialogElement !== "undefined") {
|
||||
const p = HTMLDialogElement.prototype as HTMLDialogElement & Record<string, unknown>;
|
||||
if (!p.showModal) {
|
||||
p.showModal = function (this: HTMLDialogElement) {
|
||||
this.setAttribute("open", "");
|
||||
};
|
||||
p.show = function (this: HTMLDialogElement) {
|
||||
this.setAttribute("open", "");
|
||||
};
|
||||
p.close = function (this: HTMLDialogElement) {
|
||||
this.removeAttribute("open");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const clipboard = { text: "", writeText: async (t: string) => void (clipboard.text = t) };
|
||||
Object.defineProperty(globalThis.navigator, "clipboard", { value: clipboard, configurable: true });
|
||||
(globalThis as unknown as { __clipboard: typeof clipboard }).__clipboard = clipboard;
|
||||
|
||||
if (!("BroadcastChannel" in globalThis)) {
|
||||
(globalThis as unknown as { BroadcastChannel: unknown }).BroadcastChannel = class {
|
||||
onmessage: unknown = null;
|
||||
postMessage() {}
|
||||
close() {}
|
||||
};
|
||||
}
|
||||
|
||||
if (!("randomUUID" in crypto)) {
|
||||
Object.defineProperty(crypto, "randomUUID", { value: () => Math.random().toString(36).slice(2) });
|
||||
}
|
||||
|
||||
window.open = () => null;
|
||||
HTMLAnchorElement.prototype.click = function () {};
|
||||
Reference in New Issue
Block a user