diff options
| author | Leonardo Guimaraes <leozinhoszg@gmail.com> | 2026-11-22 14:48:31 -0300 |
|---|---|---|
| committer | Leonardo Guimaraes <leozinhoszg@gmail.com> | 2026-11-22 14:48:31 -0300 |
| commit | 56c0bc848e75fa64628a7b006f33c7f0d3e02129 (patch) | |
| tree | b4100a78dceb162fa19b7ebab629c1c4379a65e5 /tests/test_progress_dashboard.py | |
| parent | 4958cb1e7230787b669bd65289fcb2d59061ea59 (diff) | |
progress_dashboard: project logo in the header, sticky filters, theme switch
The page embeds assets/logo.png as a data: URI, so it stays one file that
opens from disk; without the asset it shows no image. The filters, search
and section links stay at the top while scrolling, each status filter shows
its count, and a button clears the filters. Panel metrics are bars with
their ratio, panels without evidence move after the ones with it, and the
latest merges are a table with item tags and authors. A theme button
overrides the system theme (kept in localStorage when it is available);
the treemaps and the trend chart redraw on a theme change. Neutrals carry
a faint tint from the logo; status colours are unchanged.
Diffstat (limited to 'tests/test_progress_dashboard.py')
| -rw-r--r-- | tests/test_progress_dashboard.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_progress_dashboard.py b/tests/test_progress_dashboard.py index a2e92d9f4..f1f858a56 100644 --- a/tests/test_progress_dashboard.py +++ b/tests/test_progress_dashboard.py | |||
| @@ -224,6 +224,9 @@ class Outputs(unittest.TestCase): | |||
| 224 | with open(os.path.join(out, "progress.html"), encoding="utf-8") as f: | 224 | with open(os.path.join(out, "progress.html"), encoding="utf-8") as f: |
| 225 | page = f.read() | 225 | page = f.read() |
| 226 | self.assertNotIn("/*__PROGRESS_DATA__*/null", page) | 226 | self.assertNotIn("/*__PROGRESS_DATA__*/null", page) |
| 227 | self.assertNotIn("/*__PROGRESS_LOGO__*/", page) | ||
| 228 | if os.path.isfile(pd.LOGO): # the logo is embedded: the page needs no other file | ||
| 229 | self.assertIn('src="data:image/png;base64,', page) | ||
| 227 | self.assertIn('"schema": "leonida.progress/1"', page) | 230 | self.assertIn('"schema": "leonida.progress/1"', page) |
| 228 | with open(os.path.join(out, "progress.html"), "rb") as f: | 231 | with open(os.path.join(out, "progress.html"), "rb") as f: |
| 229 | self.assertNotIn(b"\r\n", f.read()) # LF on every platform | 232 | self.assertNotIn(b"\r\n", f.read()) # LF on every platform |
| @@ -233,6 +236,15 @@ class Outputs(unittest.TestCase): | |||
| 233 | with open(os.path.join(out, "history.json"), encoding="utf-8") as f: | 236 | with open(os.path.join(out, "history.json"), encoding="utf-8") as f: |
| 234 | self.assertEqual(len(json.load(f)), 1) | 237 | self.assertEqual(len(json.load(f)), 1) |
| 235 | 238 | ||
| 239 | def test_missing_logo_leaves_no_image(self): | ||
| 240 | old = pd.LOGO | ||
| 241 | try: | ||
| 242 | pd.LOGO = os.path.join(ROOT, "assets", "no_such_logo.png") | ||
| 243 | self.assertEqual(pd.logo_src(), "") | ||
| 244 | self.assertIn('src=""', pd.render_page({"schema": pd.SCHEMA}, [])) | ||
| 245 | finally: | ||
| 246 | pd.LOGO = old | ||
| 247 | |||
| 236 | def test_script_element_cannot_be_closed_by_data(self): | 248 | def test_script_element_cannot_be_closed_by_data(self): |
| 237 | snap = {"schema": pd.SCHEMA, "x": "</script><b>"} | 249 | snap = {"schema": pd.SCHEMA, "x": "</script><b>"} |
| 238 | self.assertNotIn("</script><b>", pd.render_page(snap, [])) | 250 | self.assertNotIn("</script><b>", pd.render_page(snap, [])) |