Files
odysseus/tests/test_research_history_expansion.py
T
Léo e3eb7137b7 refactor(css): move document, gallery and image-editor styles to their own file
static/style.css is 51,425 lines and holds every panel's styles, so two
people working on unrelated panels still edit the same file. This is the
first of three steps that give each panel group its own stylesheet. It moves
the document library, image gallery and image editor rules that can move
into static/css/documents-gallery-editor.css.

The new file is loaded eagerly from index.html immediately after style.css,
so the cascade is the concatenation of the two in that order, which is the
order those rules already had. Nothing is deferred and nothing renders
differently.

Rules moved verbatim. A rule stays in style.css when its selector group
covers more than one panel, when the class is shared design language used
from modules outside the panel, or when moving it would flip which of two
equally specific rules wins on an element the markup puts both classes on.
That last rule is what keeps this change small: most panel-prefixed rules on
this branch compete with a shared component rule somewhere later in the file.

Nineteen tests read static/style.css directly and go red the moment a rule
they assert on moves, which says nothing about the page. They now go through
tests/helpers/stylesheets.app_css(), which concatenates the stylesheets in
the order index.html loads them. The helper also exposes the <link> markup
for tests that build a synthetic page through Playwright.
2026-09-23 16:12:51 +02:00

84 lines
3.7 KiB
Python

"""Regression coverage for full-height Deep Research history expansion."""
from pathlib import Path
import re
from tests.helpers.stylesheets import app_css
ROOT = Path(__file__).resolve().parent.parent
def test_history_list_participates_in_shared_library_expansion_layout():
panel = (ROOT / "static/js/research/panel.js").read_text(encoding="utf-8")
css = app_css()
assert 'id="research-past-list" class="doclib-grid memory-list research-jobs-list"' in panel
card = css[css.index("#research-pane .research-history-card {"):]
card = card[:card.index("}")]
assert "flex: 1 1 0;" in card
assert "min-height: 0;" in card
assert "overflow: hidden;" in card
assert 'class="memory-tab-panel research-tab-panel"' in panel
assert 'class="admin-card research-new-job"' in panel
assert 'id="research-history-filters" class="skills-summary-strip"' in panel
assert 'class="research-history-search-wrap"' in panel
assert '${_researchIcon}<span>Research</span>' in panel
assert '${_magnifyIcon}' in panel
assert "pane.classList.toggle('research-results-view', tab !== 'research')" in panel
assert "display: flex; flex-direction: column; gap: 10px;" in css
assert ".research-tabs {\n flex: 0 0 auto;\n margin: -4px -4px 0;" in css
title = css[css.index("#research-pane .research-history-title-row h2 {"):]
title = title[:title.index("}")]
assert "letter-spacing: 0;" in title
desc = css[css.index("#research-pane .research-history-desc {"):]
assert "font-size: 11px;" in desc[:desc.index("}")]
assert "font: inherit; font-size: 12px; cursor: pointer; text-align: left;" in css
assert "#research-pane .research-history-search-wrap .memory-search-input" in css
assert "height: 30px;" in css
assert "background: color-mix(in srgb, var(--fg) 3%, transparent);" in css
def test_expanded_history_report_owns_and_scrolls_the_available_height():
css = app_css()
expanded = (
"#research-pane #research-past-list "
".research-job-card.doclib-card-expanded"
)
result = f"{expanded} .research-job-result"
assert expanded in css
assert "display: flex !important" in css[css.index(expanded):css.index(expanded) + 320]
assert result in css
result_rules = css[css.index(result):css.index(result) + 400]
assert "flex: 1 1 auto !important" in result_rules
assert "min-height: 0 !important" in result_rules
assert "overflow-y: auto !important" in result_rules
assert ".research-history-card:has(.doclib-card-expanded) #research-past-list" in css
assert (
"#research-pane #research-past-list:has(.doclib-card-expanded) > "
".research-job-card:not(.doclib-card-expanded)"
) in css
def test_history_tab_replays_shared_domino_entrance():
panel = (ROOT / "static/js/research/panel.js").read_text(encoding="utf-8")
assert "function _playHistoryCascade()" in panel
assert "list.classList.add('doclib-just-opened')" in panel
assert "const enteringHistory = tab === 'history'" in panel
assert "if (enteringHistory) _playHistoryCascade();" in panel
def test_research_panel_uses_one_versioned_module_instance():
app = (ROOT / "static/app.js").read_text(encoding="utf-8")
renderer = (ROOT / "static/js/chatRenderer.js").read_text(encoding="utf-8")
index = (ROOT / "static/index.html").read_text(encoding="utf-8")
panel_version = re.search(r"research/panel\.js\?v=([^'\"]+)", app)
asset_version = re.search(r"/static/app\.js\?v=([^'\"]+)", index)
style_version = re.search(r"/static/style\.css\?v=([^'\"]+)", index)
assert panel_version and renderer.count(f"research/panel.js?v={panel_version.group(1)}") == 2
assert asset_version and style_version and asset_version.group(1) == style_version.group(1)