Files
thunderheronightandClaude Opus 5.5 c6aa71d7ed Page: the footer above the script – below it, setting up its link failed and the status updates never started (since 0.5.1)
A test checks that everything the script sets up on load is already in the page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 13:26:03 +02:00

22 lines
915 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""The page itself (web/index.html): what its script touches the moment it loads must already be there.
In 0.5.1 the footer stood below the script; setting up its link failed, and the rest of the script –
among it the regular status updates – never ran: a finished job stayed "running" until a reload."""
import re
from conftest import ROOT
HTML = (ROOT / "web" / "index.html").read_text()
def test_everything_the_script_sets_up_on_load_is_above_it():
script = HTML.index("<script>")
above = set(re.findall(r'id="([\w-]+)"', HTML[:script]))
code = HTML[script:]
on_load = set(re.findall(r'^\$\("#([\w-]+)"\)\.', code, re.M)) # statements at the top level
missing = sorted(on_load - above)
assert not missing, f"used when the page loads, but not (yet) in the page: {missing}"
def test_the_status_is_polled():
assert re.search(r"^setInterval\(poll, \d+\);", HTML, re.M)