feat(web): click Executions' Started time to toggle relative/absolute
Both renderings are pre-rendered server-side into a <button>'s data-relative/data-absolute attributes; app.js swaps textContent (and the hover title, to the opposite value) on click, delegated on document.body so it survives the card's own 5s htmx poll without needing to re-wire after every swap. Click again to swap back.
This commit is contained in:
@@ -340,6 +340,34 @@ def test_status_badge_has_no_icon_for_non_terminal_states(
|
||||
assert "#i-x" not in resp.text
|
||||
|
||||
|
||||
def test_started_cell_is_a_click_to_toggle_button(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""Both the relative and absolute renderings are pre-rendered into the
|
||||
button's data attributes -- app.js swaps textContent/title on click, no
|
||||
round trip. Server-side, this test can only pin the markup the toggle
|
||||
depends on, not the click itself."""
|
||||
_stub_view(
|
||||
monkeypatch,
|
||||
ExecutionsView(
|
||||
runs=[_execution(started="2026-07-25T11:50:00Z")],
|
||||
unmatched_vms=[],
|
||||
source="admin",
|
||||
error=None,
|
||||
),
|
||||
)
|
||||
app = create_app(_make_config(tmp_path))
|
||||
app.dependency_overrides[get_backend] = lambda: _FakeBackend([])
|
||||
client = TestClient(app)
|
||||
|
||||
resp = client.get("/executions")
|
||||
|
||||
assert '<button type="button" class="time-toggle text-dim"' in resp.text
|
||||
assert 'data-showing="relative"' in resp.text
|
||||
assert 'data-relative="' in resp.text
|
||||
assert 'data-absolute="' in resp.text
|
||||
|
||||
|
||||
def test_no_cell_stacks_two_facts_on_separate_lines(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
|
||||
Reference in New Issue
Block a user