summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/style/label.pngbin0 -> 18402 bytes
-rw-r--r--tests/typ/style/label.typ54
2 files changed, 54 insertions, 0 deletions
diff --git a/tests/ref/style/label.png b/tests/ref/style/label.png
new file mode 100644
index 00000000..836899e1
--- /dev/null
+++ b/tests/ref/style/label.png
Binary files differ
diff --git a/tests/typ/style/label.typ b/tests/typ/style/label.typ
new file mode 100644
index 00000000..0b667783
--- /dev/null
+++ b/tests/typ/style/label.typ
@@ -0,0 +1,54 @@
+// Test labels.
+
+---
+// Test labelled headings.
+#show heading: text.with(10pt)
+#show heading.where(label: "intro"): underline
+
+= Introduction <intro>
+The beginning.
+
+= Conclusion
+The end.
+
+---
+// Test label after expression.
+#show strong.where(label: "v"): text.with(red)
+
+#let a = [*A*]
+#let b = [*B*]
+#a <v> #b
+
+---
+// Test labelled text.
+#show "t": it => {
+ set text(blue) if it.label == "last"
+ it
+}
+
+This is a thing [that <last>] happened.
+
+---
+// Test abusing labels for styling.
+#show strong.where(label: "red"): text.with(red)
+#show strong.where(label: "blue"): text.with(blue)
+
+*A* *B* <red> *C* <blue> *D*
+
+---
+// Test that label ignores parbreak.
+#show emph.where(label: "hide"): none
+
+_Hidden_
+<hide>
+
+_Hidden_
+
+<hide>
+_Visible_
+
+---
+// Test that label only works within one content block.
+#show strong.where(label: "strike"): strike
+*This is* [<strike>] *protected.*
+*This is not.* <strike>