| 64 | |
| 65 | |
| 66 | def test_toggle_control_and_persistence(tmp_path): |
| 67 | html = _render(tmp_path) |
| 68 | for choice in ("light", "dark", "system"): |
| 69 | assert f'data-theme-choice="{choice}"' in html |
| 70 | assert "graphify-theme" in html |
| 71 | assert "try { pref = localStorage.getItem('graphify-theme'); } catch (e) {}" in html |
| 72 | assert "try { localStorage.setItem(THEME_KEY, pref); } catch (e) {}" in html |
| 73 | assert "prefers-color-scheme: light" in html |
| 74 | assert "addEventListener('change'" in html |
| 75 | |
| 76 | |
| 77 | def test_theme_applied_in_head_before_first_paint(tmp_path): |