summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-08 11:45:54 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-08 11:45:59 +0100
commita7a4cae2948176119e8995bd8e1868f2d0e65029 (patch)
tree123e8867c939373c1c5ce5a0d20f55192c2467c2 /tests
parent0a41844cc4e645e87fe48aa31ed3a4fd40a6ab11 (diff)
Less style properties
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/text/link.pngbin49564 -> 49393 bytes
-rw-r--r--tests/typ/structure/heading.typ9
-rw-r--r--tests/typ/style/closure.typ49
-rw-r--r--tests/typ/style/show-node.typ5
-rw-r--r--tests/typ/text/indent.typ3
-rw-r--r--tests/typ/text/link.typ6
6 files changed, 12 insertions, 60 deletions
diff --git a/tests/ref/text/link.png b/tests/ref/text/link.png
index 59e62bea..9d5cb054 100644
--- a/tests/ref/text/link.png
+++ b/tests/ref/text/link.png
Binary files differ
diff --git a/tests/typ/structure/heading.typ b/tests/typ/structure/heading.typ
index d08b3687..b552f6c3 100644
--- a/tests/typ/structure/heading.typ
+++ b/tests/typ/structure/heading.typ
@@ -43,11 +43,10 @@ multiline.
---
// Test styling.
-= Heading
-
-#set heading(family: "Roboto", fill: eastern)
-#show heading: it => it.body
-#show strong: it => it.body + [!]
+#show heading.where(level: 5): it => {
+ text(family: "Roboto", fill: eastern, it.body + [!])
+}
+= Heading
===== Heading 🌍
#heading(level: 5)[Heading]
diff --git a/tests/typ/style/closure.typ b/tests/typ/style/closure.typ
deleted file mode 100644
index cd1f87df..00000000
--- a/tests/typ/style/closure.typ
+++ /dev/null
@@ -1,49 +0,0 @@
-// Test styles with closure.
-
----
-#set heading(
- size: 10pt,
- around: 0.65em,
- fill: lvl => if even(lvl) { red } else { blue },
-)
-
-= Heading 1
-== Heading 2
-=== Heading 3
-==== Heading 4
-
----
-// Test in constructor.
-#heading(
- level: 3,
- size: 10pt,
- strong: lvl => {
- assert(lvl == 3)
- false
- }
-)[Level 3]
-
----
-// Error: 22-26 expected string or auto or function, found length
-#set heading(family: 10pt)
-= Heading
-
----
-// Error: 29-38 cannot add integer and string
-#set heading(strong: lvl => lvl + "2")
-= Heading
-
----
-// Error: 22-34 expected string or auto, found boolean
-#set heading(family: lvl => false)
-= Heading
-
----
-// Error: 22-37 missing argument: b
-#set heading(family: (a, b) => a + b)
-= Heading
-
----
-// Error: 22-30 unexpected argument
-#set heading(family: () => {})
-= Heading
diff --git a/tests/typ/style/show-node.typ b/tests/typ/style/show-node.typ
index e552038d..4b0542e5 100644
--- a/tests/typ/style/show-node.typ
+++ b/tests/typ/style/show-node.typ
@@ -13,8 +13,9 @@
---
// Test full reset.
-#set heading(size: 1em, strong: false, around: none)
+#set heading(around: none)
#show heading: [B]
+#show heading: text.with(size: 10pt, weight: 400)
A [= Heading] C
---
@@ -28,8 +29,8 @@ my heading?
---
// Test integrated example.
-#set heading(size: 1em)
#show heading: it => {
+ set text(10pt)
move(dy: -1pt)[📖]
h(5pt)
if it.level == 1 {
diff --git a/tests/typ/text/indent.typ b/tests/typ/text/indent.typ
index 92b12180..97044153 100644
--- a/tests/typ/text/indent.typ
+++ b/tests/typ/text/indent.typ
@@ -2,7 +2,8 @@
---
#set par(indent: 12pt, leading: 5pt)
-#set heading(size: 10pt, above: 8pt)
+#set heading(above: 8pt)
+#show heading: text.with(size: 10pt)
The first paragraph has no indent.
diff --git a/tests/typ/text/link.typ b/tests/typ/text/link.typ
index 8e777956..8c3e6ddd 100644
--- a/tests/typ/text/link.typ
+++ b/tests/typ/text/link.typ
@@ -16,6 +16,7 @@ call #link("tel:123") for more information.
---
// Test that the period is trimmed.
+#show link: underline
https://a.b.?q=%10#. \
Wahttp://link \
Nohttps:\//link \
@@ -23,20 +24,19 @@ Nohttp\://comment
---
// Styled with underline and color.
-#set link(fill: rgb("283663"))
+#show link: it => underline(text(fill: rgb("283663"), it))
You could also make the
#link("https://html5zombo.com/")[link look way more typical.]
---
// Transformed link.
#set page(height: 60pt)
-#set link(underline: false)
#let mylink = link("https://typst.org/")[LINK]
My cool #move(dx: 0.7cm, dy: 0.7cm, rotate(10deg, scale(200%, mylink)))
---
// Link containing a block.
-#link("https://example.com/", underline: false, block[
+#link("https://example.com/", block[
My cool rhino
#move(dx: 10pt, image("/res/rhino.png", width: 1cm))
])