diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-04-13 10:39:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-13 08:39:45 +0000 |
| commit | 020294fca9a7065d4b9cf4e677f606ebaaa29b00 (patch) | |
| tree | c0027ad22046e2726c22298461327823d6b88d53 /tests/suite/foundations/label.typ | |
| parent | 72dd79210602ecc799726fc096b078afbb47f299 (diff) | |
Better test runner (#3922)
Diffstat (limited to 'tests/suite/foundations/label.typ')
| -rw-r--r-- | tests/suite/foundations/label.typ | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/tests/suite/foundations/label.typ b/tests/suite/foundations/label.typ new file mode 100644 index 00000000..2cde102c --- /dev/null +++ b/tests/suite/foundations/label.typ @@ -0,0 +1,70 @@ +// Test labels. + +--- label-show-where-selector --- +// Test labelled headings. +#show heading: set text(10pt) +#show heading.where(label: <intro>): underline + += Introduction <intro> +The beginning. + += Conclusion +The end. + +--- label-after-expression --- +// Test label after expression. +#show strong.where(label: <v>): set text(red) + +#let a = [*A*] +#let b = [*B*] +#a <v> #b + +--- label-on-text --- +// Test labelled text. +#show "t": it => { + set text(blue) if it.has("label") and it.label == <last> + it +} + +This is a thing #[that <last>] happened. + +--- label-dynamic-show-set --- +// Test abusing dynamic labels for styling. +#show <red>: set text(red) +#show <blue>: set text(blue) + +*A* *B* <red> *C* #label("bl" + "ue") *D* + +--- label-after-parbreak --- +// Test that label ignores parbreak. +#show <hide>: none + +_Hidden_ +<hide> + +_Hidden_ + +<hide> +_Visible_ + +--- label-in-block --- +// Test that label only works within one content block. +#show <strike>: strike +*This is* #[<strike>] *protected.* +*This is not.* <strike> + +--- label-unclosed-is-text --- +// Test that incomplete label is text. +1 < 2 is #if 1 < 2 [not] a label. + +--- label-text-styled-and-sequence --- +// Test label on text, styled, and sequence. +#test([Hello<hi>].label, <hi>) +#test([#[A *B* C]<hi>].label, <hi>) +#test([#text(red)[Hello]<hi>].label, <hi>) + +--- label-string-conversion --- +// Test getting the name of a label. +#test(str(<hey>), "hey") +#test(str(label("hey")), "hey") +#test(str([Hmm<hey>].label), "hey") |
