resolve test: anchors follow expanded ids
This commit is contained in:
parent
566f2bf1eb
commit
14747c94f7
1 changed files with 26 additions and 0 deletions
|
|
@ -597,3 +597,29 @@ fn resolve_reads_only_through_read() {
|
|||
let _: &dyn StatePort = &state;
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_anchor_in_a_body_follows_the_expanded_ids() {
|
||||
big(|| {
|
||||
let overlay = |anchor: &str| {
|
||||
Node::Overlay(OverlayNode {
|
||||
common: common("pop"),
|
||||
anchor: Anchor::Node(AnchorNode { node: nid(anchor) }),
|
||||
modal: false,
|
||||
dismiss: CommandRef::Param(param("dismiss")),
|
||||
children: vec![],
|
||||
})
|
||||
};
|
||||
let body = boxed("b", vec![text("target", "t"), overlay("target"), {
|
||||
let Node::Overlay(root_anchored) = overlay("b") else { unreachable!() };
|
||||
Node::Overlay(OverlayNode { common: common("pop-root"), ..root_anchored })
|
||||
}]);
|
||||
let document = surface(boxed("root", vec![use_of("u", "c", vec![command_arg("dismiss", "real")])]), &["real"]);
|
||||
let resolution = run(&document, &state_with(&[composition("c", &[("dismiss", ParamKind::Command)], body)]));
|
||||
assert_eq!(resolution.diagnostics, vec![]);
|
||||
for (id, target) in [("u/pop", "u/target"), ("u/pop-root", "u")] {
|
||||
let Node::Overlay(found) = node_of(&resolution, id) else { panic!("not an Overlay") };
|
||||
assert_eq!(found.anchor, Anchor::Node(AnchorNode { node: nid(target) }), "{id}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue