diff --git a/slhx-js/tests/runtime.rs b/slhx-js/tests/runtime.rs index 3f44fff..c0b1d15 100644 --- a/slhx-js/tests/runtime.rs +++ b/slhx-js/tests/runtime.rs @@ -9,6 +9,17 @@ fn runtime_posts_urlencoded_forms_by_default() { assert!(source.contains("application/x-www-form-urlencoded;charset=UTF-8")); } +#[test] +fn runtime_interval_dispatch_avoids_duplicate_timers() { + // req: convention/005 + let source = slhx_js::RUNTIME_JS; + + assert!(source.contains("root.querySelectorAll(\"[data-slhx-every]\")")); + assert!(source.contains("if (timers.has(el)) return")); + assert!(source.contains("setInterval(() => document.contains(el) ? send(el, \"every\")")); + assert!(source.contains("clearInterval(timers.get(el))")); +} + #[test] fn runtime_toggles_pending_conventions_around_requests() { // req: convention/007 req: convention/008