1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Removing JS adding #terminal-init so that unit tests don't have global state (#4627)

This commit is contained in:
Sebastian Malton 2022-01-04 10:20:41 -05:00 committed by GitHub
parent 02056a6090
commit 2a31c5a0d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 11 deletions

View File

@ -91,6 +91,15 @@ html, body {
overflow: hidden;
}
#terminal-init {
position: absolute;
top: 0;
left: 0;
height: 0;
visibility: hidden;
overflow: hidden;
}
#app {
height: 100%;
min-height: 100%;

View File

@ -34,17 +34,9 @@ import { clipboard } from "electron";
import logger from "../../../common/logger";
export class Terminal {
public static readonly spawningPool = (() => {
// terminal element must be in DOM before attaching via xterm.open(elem)
// https://xtermjs.org/docs/api/terminal/classes/terminal/#open
const pool = document.createElement("div");
pool.className = "terminal-init";
pool.style.cssText = "position: absolute; top: 0; left: 0; height: 0; visibility: hidden; overflow: hidden";
document.body.appendChild(pool);
return pool;
})();
public static get spawningPool() {
return document.getElementById("terminal-init");
}
static async preloadFonts() {
const fontPath = require("../fonts/roboto-mono-nerd.ttf").default; // eslint-disable-line @typescript-eslint/no-var-requires

View File

@ -6,6 +6,7 @@
<body>
<div id="app"></div>
<div id="terminal-init"></div>
</body>
</html>