fix(l4d2-web): show empty-state when overlay dir is empty, not just missing
Tickrate and other seeded examples whose overlay directory exists but hasn't been built yet rendered a visually blank Files panel — entries was [] (not None), so the template fell through to an empty <ul>. Use 'not file_tree_root_entries' so both None (dir missing) and [] (dir empty) trigger the 'No files yet' message. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2ab54a3800
commit
c958d0352a
2 changed files with 19 additions and 1 deletions
|
|
@ -131,7 +131,7 @@
|
||||||
|
|
||||||
<section class="panel">
|
<section class="panel">
|
||||||
<h2>Files</h2>
|
<h2>Files</h2>
|
||||||
{% if file_tree_root_entries is none %}
|
{% if not file_tree_root_entries %}
|
||||||
<p class="muted">No files yet — build this overlay to populate it.</p>
|
<p class="muted">No files yet — build this overlay to populate it.</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set entries = file_tree_root_entries %}
|
{% set entries = file_tree_root_entries %}
|
||||||
|
|
|
||||||
|
|
@ -324,6 +324,24 @@ def test_overlay_detail_shows_empty_state_when_overlay_dir_missing(
|
||||||
assert "No files yet" in text
|
assert "No files yet" in text
|
||||||
|
|
||||||
|
|
||||||
|
def test_overlay_detail_shows_empty_state_when_overlay_dir_is_empty(
|
||||||
|
app, left4me_root: Path
|
||||||
|
) -> None:
|
||||||
|
"""A built overlay whose directory has been wiped (or seeded but never
|
||||||
|
built) should also fall back to the empty-state message — not render an
|
||||||
|
invisible empty <ul>."""
|
||||||
|
user_id = _make_user()
|
||||||
|
overlay_id = _make_overlay(left4me_root, user_id=user_id, name="my")
|
||||||
|
# _make_overlay leaves the directory in place but empty.
|
||||||
|
|
||||||
|
client = _client_for(app, user_id)
|
||||||
|
response = client.get(f"/overlays/{overlay_id}")
|
||||||
|
text = response.get_data(as_text=True)
|
||||||
|
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert "No files yet" in text
|
||||||
|
|
||||||
|
|
||||||
def test_overlay_detail_files_section_present_for_workshop_overlays(
|
def test_overlay_detail_files_section_present_for_workshop_overlays(
|
||||||
app, left4me_root: Path
|
app, left4me_root: Path
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue