diff options
Diffstat (limited to 'tests/test_frontend.py')
| -rw-r--r-- | tests/test_frontend.py | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/tests/test_frontend.py b/tests/test_frontend.py index 635b57a..42126b8 100644 --- a/tests/test_frontend.py +++ b/tests/test_frontend.py @@ -69,8 +69,9 @@ class Frontend(unittest.TestCase): status, body = self.get("/") self.assertEqual(status, 200) text = body.decode() - for asset in ("app.js", "deck.css", "vendor/gridstack/gridstack-all.js"): + for asset in ("app.js", "deck.css"): self.assertIn(asset, text) + self.assertNotIn("gridstack", text) def test_pwa_manifest(self): self.assertIn(b'rel="manifest"', self.get("/")[1]) @@ -80,9 +81,8 @@ class Frontend(unittest.TestCase): for size in (192, 512): self.assertEqual(self.get(f"/icon-{size}.png")[0], 200) - def test_vendor_assets_served(self): - for path in ("/vendor/gridstack/gridstack-all.js", "/vendor/gridstack/gridstack.min.css"): - self.assertEqual(self.get(path)[0], 200, path) + def test_vendor_gridstack_is_gone(self): + self.assertEqual(self.get("/vendor/gridstack/gridstack-all.js")[0], 404) def test_css_uses_udt_vars(self): status, body = self.get("/deck.css") @@ -96,16 +96,19 @@ class Frontend(unittest.TestCase): for part in ("export default", "mount", "update"): self.assertIn(part, text, name) - def test_panel_for_every_module(self): - from deckit.modules import build - names = [m["name"] for m in build({}).names()] - self.assertIn("stats", names) - for name in names: + def test_panels(self): + # Tabs and the music card have panels; stats, tablet, llm and actions + # are drawn by dashboard.js; k1c, sbbuilder and obs give it a slot. + for name in ("music", "k1c", "obs", "windows", "assistant"): self.assert_panel(name) + for name in ("k1c", "sbbuilder", "obs"): + text = self.get(f"/modules/{name}.js")[1].decode() + self.assertIn("export const busy", text, name) + self.assertIn("export function slot", text, name) + self.assertEqual(self.get("/dashboard.js")[0], 200) def test_panels_have_their_scoped_wrapper(self): self.assertIn(b'class="music"', self.get("/modules/music.js")[1]) - self.assertIn(b'class="sbb"', self.get("/modules/sbbuilder.js")[1]) def test_tabbed_shell(self): self.assertIn(b'id="tabs"', self.get("/")[1]) @@ -117,12 +120,11 @@ class Frontend(unittest.TestCase): self.assertIn(b'tab: "OBS"', self.get("/modules/obs.js")[1]) self.assertIn(b'tab: "Windows"', self.get("/modules/windows.js")[1]) - def test_layout_is_browser_local(self): - status, body = self.get("/app.js") - self.assertEqual(status, 200) - text = body.decode() - for part in ("GridStack", "localStorage", "deckit.layout", "gs-id"): - self.assertIn(part, text) + def test_dashboard_is_one_fixed_screen(self): + text = self.get("/app.js")[1].decode() + self.assertIn("dashboard.js", text) + for gone in ("GridStack", "deckit.layout", "deckit.folded"): + self.assertNotIn(gone, text) if __name__ == "__main__": |
