feat(runtime): add portable runtime support
req: push/009 req: push/010 req: push/011
This commit is contained in:
@@ -398,6 +398,23 @@ fn runtime_applies_sse_effect_batches_inside_roots() {
|
||||
assert!(source.contains("emit(root, \"hemx:sse-error\", url)"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_applies_binary_websocket_effect_batches_inside_roots() {
|
||||
// req: push/001 req: push/003 req: push/009 req: runtime/001 req: failure/001
|
||||
let source = hemx_js::RUNTIME_JS;
|
||||
|
||||
assert!(source.contains("const webSockets = new WeakMap()"));
|
||||
assert!(source.contains("const url = root.getAttribute(\"data-hemx-ws\")"));
|
||||
assert!(source.contains("if (href.origin !== location.origin)"));
|
||||
assert!(source.contains("href.protocol = href.protocol === \"https:\" ? \"wss:\" : \"ws:\""));
|
||||
assert!(source.contains("socket.binaryType = \"arraybuffer\""));
|
||||
assert!(source.contains("if (!(event.data instanceof ArrayBuffer)) throw new Error"));
|
||||
assert!(source.contains("applyBatch(event.data, root)"));
|
||||
assert!(source.contains("showError(root, error)"));
|
||||
assert!(source.contains("emit(root, \"hemx:ws-error\", url)"));
|
||||
assert!(source.contains("if (socket) socket.close()"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_page_swaps_lowered_slot_ids() {
|
||||
// req: wire/001
|
||||
|
||||
Reference in New Issue
Block a user