mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
write tests for within selector
This commit is contained in:
parent
5fb96b28b4
commit
2ac47bc13e
BIN
tests/ref/query-within.png
Normal file
BIN
tests/ref/query-within.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 560 B |
@ -250,3 +250,27 @@
|
|||||||
t("b")
|
t("b")
|
||||||
block(height: 1fr, metadata("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(<strong>).within(heading),
|
||||||
|
([a], [c]),
|
||||||
|
)
|
||||||
|
|
||||||
|
#test-selector(
|
||||||
|
selector(<strong>).within(heading.where(level: 2)),
|
||||||
|
([c], ),
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user