oficina / fichas Public

Hotfix: primary and danger buttons are filled again

3780532's depth styles matched rst-btn="primary" exactly, but rst-btn's
value is a word list ("primary lg"), so every form's Save and the red
Delete on a confirm page were drawn as plain white pills. Matched by
word (~=) now; TestPrimaryButtonsAreFilled checks the fill on the card
form, the add-field form and the delete confirm (fails without the fix).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 0e2e8fd1cb753d10d7a4304730d1847e956922f9 parent 3780532
2 files changed, +44 −4
  • internal/fichas/static/fichas.css +4 −4
  • internal/fichastest/browser_test.go +40 −0

CI passed — run details

CI log
=== vet ===
go vet ./...
go vet -tags browser ./internal/fichastest/
=== fmt ===
=== test ===
go test ./...
?   	amadan.net/oficina/fichas/cmd/fichas	[no test files]
ok  	amadan.net/oficina/fichas/internal/fichas	1.892s
?   	amadan.net/oficina/fichas/internal/fichas/icons	[no test files]
ok  	amadan.net/oficina/fichas/internal/fichas/seal	(cached)
ok  	amadan.net/oficina/fichas/internal/fichastest	1.167s
?   	amadan.net/oficina/fichas/scripts/mockups	[no test files]
?   	amadan.net/oficina/fichas/scripts/preview	[no test files]
?   	amadan.net/oficina/fichas/scripts/writeestilo	[no test files]
=== migration-check ===
go tool rastrillo migration check
rastrillo migration check: models and migrations agree
diff --git a/internal/fichas/static/fichas.css b/internal/fichas/static/fichas.css
index c2cb4dc..8e727f4 100644
--- a/internal/fichas/static/fichas.css
+++ b/internal/fichas/static/fichas.css
@@ -360,7 +360,7 @@
inset 0 1px 0 light-dark(rgb(255 255 255 / 0.8), rgb(255 255 255 / 0.06)),
0 1px 2px rgb(23 32 60 / 0.08);
}
-[rst-page] [rst-btn]:not([rst-btn="primary"]):not([rst-btn="danger"]) {
+[rst-page] [rst-btn]:not([rst-btn~="primary"]):not([rst-btn~="danger"]) {
border-color: transparent;
background-color: var(--rst-surface);
color: var(--rst-text);
@@ -369,15 +369,15 @@
0 0 0 1px var(--rst-line),
0 1px 2px rgb(23 32 60 / 0.08);
}
-[rst-page] [rst-btn]:not([rst-btn="primary"]):not([rst-btn="danger"]):hover { background-color: var(--rst-surface-2); }
-[rst-page] [rst-btn="primary"] {
+[rst-page] [rst-btn]:not([rst-btn~="primary"]):not([rst-btn~="danger"]):hover { background-color: var(--rst-surface-2); }
+[rst-page] [rst-btn~="primary"] {
padding-inline: 18px;
box-shadow:
inset 0 1px 0 rgb(255 255 255 / 0.22),
0 1px 1px rgb(23 32 60 / 0.10),
0 8px 18px -8px light-dark(color-mix(in srgb, var(--rst-accent) 80%, transparent), color-mix(in srgb, var(--rst-accent) 30%, transparent));
}
-[rst-page] [rst-btn="primary"]:hover { background-color: var(--rst-accent-strong); }
+[rst-page] [rst-btn~="primary"]:hover { background-color: var(--rst-accent-strong); }
[rst-page] [rst-seg-tabs] {
border-radius: 999px;
padding: 3px;
diff --git a/internal/fichastest/browser_test.go b/internal/fichastest/browser_test.go
index 4ac0966..d84f4ff 100644
--- a/internal/fichastest/browser_test.go
+++ b/internal/fichastest/browser_test.go
@@ -409,3 +409,43 @@ func TestRailIconsSitOnTheTextsCentreLine(t *testing.T) {
}
}
}
+
+// TestPrimaryButtonsAreFilled: a form's primary submit is filled with the
+// accent, and a danger submit is not a plain white pill. rst-btn's value
+// is a word list ("primary lg"); the depth styles once matched only
+// rst-btn="primary" exactly and turned every form's Save white.
+func TestPrimaryButtonsAreFilled(t *testing.T) {
+ var id int64
+ rig := browserApp(t, func(ctx context.Context, d *db.DB, cfg fichas.Config) {
+ m, _ := fichas.EnsureMember(ctx, d.G, cfg.Sealer, TestOwner)
+ c, err := fichas.CreateCard(ctx, d.G, cfg.Sealer, fichas.TypeCustomer, fichas.Person(m.ID), map[string]string{fichas.FieldName: "Brightwater Labs"})
+ if err != nil {
+ t.Fatalf("seed: %v", err)
+ }
+ id = c.ID
+ })
+ const fill = `(() => {
+ const probe = document.createElement('span'); probe.style.color = 'var(--rst-accent)'; document.body.append(probe)
+ const accent = getComputedStyle(probe).color; probe.remove()
+ const b = document.querySelector('[rst-page] form [rst-btn~="primary"], [rst-page] form [rst-btn~="danger"]')
+ return { bg: getComputedStyle(b).backgroundColor, accent, label: b.textContent.trim() }
+ })()`
+ type facts struct{ Bg, Accent, Label string }
+ for _, page := range []string{"/cards/new?type=t_customer", "/t/t_customer/fields/new", "/cards/" + itoa(id) + "/delete"} {
+ var f facts
+ rig.Run(
+ chromedp.Navigate(rig.Origin+page),
+ chromedp.WaitVisible(`[rst-page] form [rst-btn]`),
+ harness.Into(&f, chromedp.Evaluate[facts](fill)),
+ )
+ if strings.HasSuffix(page, "/delete") {
+ if f.Bg == "rgb(255, 255, 255)" || f.Bg == "rgba(0, 0, 0, 0)" {
+ t.Errorf("%s: the danger button %q is not filled (%s)", page, f.Label, f.Bg)
+ }
+ continue
+ }
+ if f.Bg != f.Accent {
+ t.Errorf("%s: the primary %q is %s, not the accent %s", page, f.Label, f.Bg, f.Accent)
+ }
+ }
+}