test(js): cover generated target policy
Cover that runtime updates use generated slot/resource ids and do not expose response-side retargeting or CSS fragment selection conventions. req: target_policy/001 req: target_policy/002
This commit is contained in:
@@ -20,6 +20,20 @@ fn runtime_preserves_multipart_file_upload_fallback_shape() {
|
||||
assert!(source.contains("if (body instanceof URLSearchParams) headers[\"Content-Type\"] = \"application/x-www-form-urlencoded;charset=UTF-8\""));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_targets_generated_resources_not_response_selectors() {
|
||||
// req: target_policy/001 req: target_policy/002
|
||||
let source = slhx_js::RUNTIME_JS;
|
||||
|
||||
assert!(source.contains("function targetFor(scope, ref)"));
|
||||
assert!(source.contains("return scope.querySelector(`[data-sid=\"${ref.resource.id}\"], [data-slot-id=\"${ref.resource.id}\"]`)"));
|
||||
assert!(source.contains("return scope.querySelector(`[data-sid=\"${id}\"][data-key=\"${escapedKey}\"], [data-sid=\"${id}\"] [data-key=\"${escapedKey}\"], [data-slot-id=\"${id}\"][data-key=\"${escapedKey}\"], [data-slot-id=\"${id}\"] [data-key=\"${escapedKey}\"]`)"));
|
||||
assert!(source.contains("doc.querySelectorAll(\"[data-sid], [data-slot-id]\")"));
|
||||
assert!(source.contains("if (!target) return missing(scope, op.target)"));
|
||||
assert!(!source.contains("data-slhx-target"));
|
||||
assert!(!source.contains("data-slhx-select"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_interval_dispatch_avoids_duplicate_timers() {
|
||||
// req: convention/005
|
||||
|
||||
Reference in New Issue
Block a user