summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-03-17 14:39:30 +0100
committerLaurenz <laurmaedje@gmail.com>2023-03-17 16:04:12 +0100
commitc47e4cb4969836e7fb8955361728105555b6d722 (patch)
tree08b613938b7bc7b82ae358aa8f117af11c1db6a8 /tests
parent312197b276748e1a17258ad21837850f582a467c (diff)
State
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/meta/state.pngbin0 -> 47353 bytes
-rw-r--r--tests/typ/meta/counter.typ1
-rw-r--r--tests/typ/meta/state.typ24
3 files changed, 24 insertions, 1 deletions
diff --git a/tests/ref/meta/state.png b/tests/ref/meta/state.png
new file mode 100644
index 00000000..d48e1dc3
--- /dev/null
+++ b/tests/ref/meta/state.png
Binary files differ
diff --git a/tests/typ/meta/counter.typ b/tests/typ/meta/counter.typ
index 9f6f4c8a..539af6b9 100644
--- a/tests/typ/meta/counter.typ
+++ b/tests/typ/meta/counter.typ
@@ -6,7 +6,6 @@
Final: #mine.final() \
#mine.step()
-#mine.step()
First: #mine.get() \
#mine.update(7)
#mine.both("1 of 1") \
diff --git a/tests/typ/meta/state.typ b/tests/typ/meta/state.typ
new file mode 100644
index 00000000..dd34deac
--- /dev/null
+++ b/tests/typ/meta/state.typ
@@ -0,0 +1,24 @@
+// Test state.
+
+---
+#set page(width: 200pt)
+#set text(8pt)
+
+#let ls = state("lorem", lorem(1000).split("."))
+#let loremum(count) = {
+ ls.get(list => list.slice(0, count).join(".").trim() + ".")
+ ls.update(list => list.slice(count))
+}
+
+#let fs = state("fader", red)
+#let trait(title) = block[
+ #fs.get(color => text(fill: color)[
+ *#title:* #loremum(1)
+ ])
+ #fs.update(color => color.lighten(30%))
+]
+
+#trait[Boldness]
+#trait[Adventure]
+#trait[Fear]
+#trait[Anger]