test(js): cover interval dispatch
Cover data-slhx-every runtime behavior: root scanning, duplicate timer avoidance, interval dispatch, and cleanup when elements leave the document. req: convention/005
This commit is contained in:
@@ -9,6 +9,17 @@ fn runtime_posts_urlencoded_forms_by_default() {
|
|||||||
assert!(source.contains("application/x-www-form-urlencoded;charset=UTF-8"));
|
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]
|
#[test]
|
||||||
fn runtime_toggles_pending_conventions_around_requests() {
|
fn runtime_toggles_pending_conventions_around_requests() {
|
||||||
// req: convention/007 req: convention/008
|
// req: convention/007 req: convention/008
|
||||||
|
|||||||
Reference in New Issue
Block a user