diff --git a/tests/ref/query-within.png b/tests/ref/query-within.png new file mode 100644 index 000000000..2092df0a7 Binary files /dev/null and b/tests/ref/query-within.png differ diff --git a/tests/suite/introspection/query.typ b/tests/suite/introspection/query.typ index 94e82820e..67d54c44b 100644 --- a/tests/suite/introspection/query.typ +++ b/tests/suite/introspection/query.typ @@ -250,3 +250,27 @@ t("b") block(height: 1fr, metadata("b")) } + +--- query-within --- + +#let test-selector(selector, ref) = context { + test(query(selector).map(e => e.body), ref) +} + += A #strong[a] #label("strong") + +#strong[b] #label("strong") + +== B + +== C #strong[c] #label("strong") +> +#test-selector( + selector().within(heading), + ([a], [c]), +) + +#test-selector( + selector().within(heading.where(level: 2)), + ([c], ), +)