mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
32 lines
630 B
Typst
32 lines
630 B
Typst
// Tests whether the label is accessible through the has, field,
|
|
// and fields accessors
|
|
// Ref: false
|
|
|
|
---
|
|
// Test whether the label is accessible through the has method
|
|
#show heading: it => {
|
|
assert(it.has("label"))
|
|
it
|
|
}
|
|
|
|
= Hello, world! <my_label>
|
|
|
|
---
|
|
// Test whether the label is accessible through the field method
|
|
#show heading: it => {
|
|
assert(str(it.label) == "my_label")
|
|
it
|
|
}
|
|
|
|
= Hello, world! <my_label>
|
|
|
|
---
|
|
// Test whether the label is accessible through the fields method
|
|
#show heading: it => {
|
|
assert("label" in it.fields())
|
|
assert(str(it.fields().label) == "my_label")
|
|
it
|
|
}
|
|
|
|
= Hello, world! <my_label>
|