Files
odysseus/tests/test_interrupted_resume_label_static.py
T
Léo 1323fab0bd refactor(tests): read the whole cascade instead of style.css alone
static/style.css no longer holds every rule. 79 rules for the document,
gallery and editor panels now live in static/css/, yet 27 browser tests still
built their synthetic page with a single <link> to style.css, and 51 more read
that one file as though it were the whole cascade. Those tests kept passing
while covering less: a rule that moved became invisible to the assertion that
was meant to pin it.

Python readers now call tests.helpers.stylesheets.app_css(), and synthetic
pages are built from stylesheet_link_tags() so they load exactly what
index.html loads, in the same order. The helper already existed; this moves
the remaining callers onto it.

test_portal_dropdown_z_js parametrised over a file list including style.css to
assert an absence. Checking a negative against one file of a split stylesheet
is how a moved rule escapes, so the CSS case now checks the concatenation.

Two guards keep it from coming back: one fails on any test reading
static/style.css directly, the other on any synthetic page linking it alone.
Both name the helper to use.

No production code changes. Suite is unchanged at 6 pre-existing failures.
2026-09-29 17:05:29 +02:00

47 lines
1.9 KiB
Python

from pathlib import Path
import re
from tests.helpers.stylesheets import app_css
ROOT = Path(__file__).resolve().parents[1]
CHAT = (ROOT / "static/js/chat.js").read_text()
RENDERER = (ROOT / "static/js/chatRenderer.js").read_text()
STYLE = app_css()
APP = (ROOT / "static/app.js").read_text()
INDEX = (ROOT / "static/index.html").read_text()
def test_live_interruption_controls_have_visible_resume_labels():
assert CHAT.count('continueBtn.innerHTML = \'<span class="resume-btn-label">Resume</span>') == 2
assert "_cont.innerHTML = '<span class=\"resume-btn-label\">Resume</span>" in CHAT
def test_restored_interruption_control_has_visible_resume_label():
assert "continueBtn.className = 'continue-btn resume-btn';" in RENDERER
assert 'continueBtn.innerHTML = \'<span class="resume-btn-label">Resume</span>' in RENDERER
def test_resume_label_uses_scoped_compact_button_styling():
assert ".continue-btn.resume-btn {" in STYLE
assert "display:inline-flex;" in STYLE
resume_start = STYLE.index(".continue-btn.resume-btn {")
resume_block = STYLE[resume_start:STYLE.index(" }", resume_start) + len(" }")]
assert "border:none;" in resume_block
assert "top:2px;" in resume_block
assert ".continue-btn.resume-btn .resume-btn-icon" in STYLE
def test_resume_uses_control_message_instead_of_copying_partial_output():
assert CHAT.count("msgInput.value = 'Continue from where you left off.';") == 2
assert "cutoff.slice(-500)" not in CHAT
assert "msgInput.value = 'Continue from where you left off.';" in RENDERER
assert "cutoff.slice(-500)" not in RENDERER
def test_chat_controller_uses_one_module_identity():
app_version = re.search(r"\./js/chat\.js\?v=([A-Za-z0-9_-]+)", APP)
index_versions = re.findall(r"/static/js/chat\.js\?v=([A-Za-z0-9_-]+)", INDEX)
assert app_version
assert len(index_versions) == 2
assert set(index_versions) == {app_version.group(1)}