oficina / estilo Public

Use the defined divider token and gate shared CSS references

Paul Campbell pushed by paul@keymail.dev 0bcb9287988d0b766950faf792a2a2fa266f1694 parent a670e6b
2 files changed, +27 −1
  • credits/credits.css +1 −1
  • credits/tokens_test.go +26 −0

CI passed — run details

diff --git a/credits/credits.css b/credits/credits.css
index a44d881..55bbec2 100644
--- a/credits/credits.css
+++ b/credits/credits.css
@@ -1,6 +1,6 @@
[estilo-credits] { min-inline-size: 0; overflow-wrap: anywhere; }
[estilo-credits] > ul { list-style: none; padding: 0; }
-[estilo-credits] > ul > li { border-block-end: 1px solid var(--rst-border); padding-block: .5rem; }
+[estilo-credits] > ul > li { border-block-end: 1px solid var(--rst-line); padding-block: .5rem; }
[estilo-credits] summary { min-block-size: 24px; padding-block: .5rem; cursor: pointer; }
[estilo-credits] a { display: inline-block; min-block-size: 24px; max-inline-size: 100%; }
[estilo-credits] pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
diff --git a/credits/tokens_test.go b/credits/tokens_test.go
new file mode 100644
index 0000000..ef6b798
--- /dev/null
+++ b/credits/tokens_test.go
@@ -0,0 +1,26 @@
+package credits
+
+import (
+ "amadan.net/oficina/estilo.git/theme"
+ "github.com/carlosframework/rastrillo/ui"
+ "regexp"
+ "testing"
+)
+
+// Mutation-checked: the former undefined --rst-border reference must fail.
+func TestCreditStylesUseDefinedTokens(t *testing.T) {
+ definitions := map[string]bool{}
+ styles := append(append([]byte{}, ui.TokensCSS()...), theme.CSS()...)
+ for _, m := range regexp.MustCompile(`(--rst-[a-z0-9-]+)\s*:`).FindAllSubmatch(styles, -1) {
+ definitions[string(m[1])] = true
+ }
+ references := regexp.MustCompile(`var\(\s*(--rst-[a-z0-9-]+)`).FindAllSubmatch(CSS(), -1)
+ if len(references) == 0 {
+ t.Fatal("credit token reference disappeared")
+ }
+ for _, m := range references {
+ if !definitions[string(m[1])] {
+ t.Fatal("credit stylesheet uses undefined token", string(m[1]))
+ }
+ }
+}