feat: replace xterm.js script tags with ghostty-web in index.html

This commit is contained in:
Ken
2026-05-28 06:16:06 +00:00
parent 10b57c8f60
commit f2d999973a
2 changed files with 29 additions and 3 deletions
+2 -3
View File
@@ -10,7 +10,7 @@
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32.png" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="stylesheet" href="/vendor/xterm.css" />
<!-- ghostty-web uses canvas rendering, no CSS needed -->
<link rel="stylesheet" href="/style.css" />
<title>muxplex</title>
</head>
@@ -269,8 +269,7 @@
</dialog>
<!-- ── Scripts ──────────────────────────────────────────────────────────── -->
<script src="/vendor/xterm.js"></script>
<script src="/vendor/xterm-addon-fit.js"></script>
<script src="/vendor/ghostty-web.js"></script>
<script src="/vendor/xterm-addon-web-links.js"></script>
<script src="/vendor/xterm-addon-search.js"></script>
<script src="/vendor/addon-image.js"></script>
+27
View File
@@ -5,10 +5,37 @@ import re
JS_PATH = pathlib.Path(__file__).parent.parent / "frontend" / "app.js"
TERMINAL_JS_PATH = pathlib.Path(__file__).parent.parent / "frontend" / "terminal.js"
INDEX_HTML_PATH = pathlib.Path(__file__).parent.parent / "frontend" / "index.html"
# Read once per module — tests are read-only so sharing is safe.
_JS: str = JS_PATH.read_text()
_TERMINAL_JS: str = TERMINAL_JS_PATH.read_text()
_INDEX_HTML: str = INDEX_HTML_PATH.read_text()
# ── index.html script tag migration (ghostty-web) ────────────────────
def test_index_html_loads_ghostty_web_js() -> None:
"""index.html must load ghostty-web.js."""
assert "ghostty-web.js" in _INDEX_HTML, (
"index.html must include a <script> tag for ghostty-web.js"
)
def test_index_html_no_xterm_js_script() -> None:
"""index.html must not load xterm.js directly."""
assert 'src="/vendor/xterm.js"' not in _INDEX_HTML, (
"index.html must not include a <script> tag for xterm.js — use ghostty-web.js instead"
)
def test_index_html_no_xterm_addon_fit_script() -> None:
"""index.html must not load xterm-addon-fit.js (ghostty-web bundles fit natively)."""
assert "xterm-addon-fit.js" not in _INDEX_HTML, (
"index.html must not include a <script> tag for xterm-addon-fit.js — "
"ghostty-web bundles fit natively"
)
# ── Palette state variables must be removed ──────────────────────────────────