From f02b4de1ad63da0c222ce4d329c9441bed25ba46 Mon Sep 17 00:00:00 2001 From: slhx agent Date: Mon, 25 May 2026 22:57:22 +0200 Subject: [PATCH] test(js): cover pending conventions Cover pending-class, indicator visibility, and disable-while-pending runtime conventions around request execution. req: convention/007 req: convention/008 --- slhx-js/tests/runtime.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/slhx-js/tests/runtime.rs b/slhx-js/tests/runtime.rs index 693e921..3f44fff 100644 --- a/slhx-js/tests/runtime.rs +++ b/slhx-js/tests/runtime.rs @@ -9,6 +9,22 @@ fn runtime_posts_urlencoded_forms_by_default() { assert!(source.contains("application/x-www-form-urlencoded;charset=UTF-8")); } +#[test] +fn runtime_toggles_pending_conventions_around_requests() { + // req: convention/007 req: convention/008 + let source = slhx_js::RUNTIME_JS; + + assert!(source.contains("function showPending(el, on)")); + assert!(source.contains("el.getAttribute(\"data-slhx-pending-class\")")); + assert!(source.contains("el.classList.toggle(klass, on)")); + assert!(source.contains("root.querySelectorAll(\"[data-slhx-indicator]\")")); + assert!(source.contains("i.hidden = !on")); + assert!(source.contains("el.hasAttribute(\"data-slhx-disable-while-pending\")")); + assert!(source.contains("c.disabled = on")); + assert!(source.contains("showPending(target, true)")); + assert!(source.contains("showPending(target, false)")); +} + #[test] fn runtime_confirms_before_handler_dispatch() { // req: convention/004