test(js): cover sse root dispatch
Cover data-slhx-sse EventSource setup, slhx/message event handling, root-scoped EffectBatch application, and SSE error emission. req: push/001 req: push/003 req: runtime/001
This commit is contained in:
@@ -128,6 +128,20 @@ fn runtime_refuses_partial_updates_on_fingerprint_mismatch() {
|
|||||||
assert!(source.contains("if (expected && String(batch.fingerprint) !== expected)"));
|
assert!(source.contains("if (expected && String(batch.fingerprint) !== expected)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn runtime_applies_sse_effect_batches_inside_roots() {
|
||||||
|
// req: push/001 req: push/003 req: runtime/001
|
||||||
|
let source = slhx_js::RUNTIME_JS;
|
||||||
|
|
||||||
|
assert!(source.contains("const sseSources = new WeakMap()"));
|
||||||
|
assert!(source.contains("const url = root.getAttribute(\"data-slhx-sse\")"));
|
||||||
|
assert!(source.contains("new EventSource(new URL(url, location.href).href)"));
|
||||||
|
assert!(source.contains("source.addEventListener(\"slhx\", (event) => applySseMessage(root, event))"));
|
||||||
|
assert!(source.contains("source.addEventListener(\"message\", (event) => applySseMessage(root, event))"));
|
||||||
|
assert!(source.contains("applyBatch(bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength), root)"));
|
||||||
|
assert!(source.contains("emit(root, \"slhx:sse-error\", url)"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn runtime_page_swaps_lowered_slot_ids() {
|
fn runtime_page_swaps_lowered_slot_ids() {
|
||||||
// req: wire/001
|
// req: wire/001
|
||||||
|
|||||||
Reference in New Issue
Block a user