From d54ecab4a318295dad7f02c0e70ddfc1424132f4 Mon Sep 17 00:00:00 2001 From: ai-bot Date: Fri, 2 Oct 2026 12:37:50 +0000 Subject: [PATCH] tests: form rules for hidden and derived fields (section 20) --- tests/test_health_check_form.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/test_health_check_form.py b/tests/test_health_check_form.py index 2f5a941..ea36dc9 100644 --- a/tests/test_health_check_form.py +++ b/tests/test_health_check_form.py @@ -46,6 +46,29 @@ class HealthCheckFormTests(unittest.TestCase): for removed in ("seed_backup_status", "address_verified", "derivation_height"): self.assertNotIn(removed, script) + def test_form_script_derives_and_carries_values(self): + script = (ROOT / "static" / "health-check.js").read_text(encoding="utf-8") + self.assertIn("/api/previous-values", script) + self.assertIn("derivedValues", script) + self.assertIn("carriedSecurity", script) + self.assertIn("Derived from availability", script) + self.assertIn("Carried forward from the last saved check", script) + self.assertIn("placeholder", script) + # The cloud key no longer asks for the cloud results in the form. + self.assertNotIn("Cloud health check", script) + self.assertNotIn("Provider operational", script) + + def test_form_can_hide_the_compatibility_grid_for_the_cloud_key(self): + html = (ROOT / "static" / "health-check.html").read_text(encoding="utf-8") + script = (ROOT / "static" / "health-check.js").read_text(encoding="utf-8") + self.assertIn('id="software-section"', html) + self.assertIn("#software-section .field-grid", script) + + def test_stylesheet_makes_the_hidden_attribute_work_on_grid_containers(self): + styles = (ROOT / "static" / "styles.css").read_text(encoding="utf-8") + self.assertIn(".form-stack[hidden]", styles) + self.assertIn(".field-grid[hidden]", styles) + if __name__ == "__main__": unittest.main()