vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Center the sign-in and registration column
e452b63c760465c09f93dce319c6839b5893a0c6 · Keenan Nemetz · 2d ago · parent 0a12642f
Center the sign-in and registration column The auth pages capped their card at 34rem but set only a top margin, so the column sat on the left edge of the page while the topbar and every other page center themselves. The card now centers on the page column's center line at every width; the measure and the 8vh vertical offset are unchanged. A test keeps the rule honest: the three auth pages must render their card in the auth column, and the .auth rule must keep both its measure and its auto inline margin. closes: 01M8QBQSVG90REZ7SBMH02J9Q6
server/ui_test.go +42
| @@ -355,6 +355,48 @@ func TestCommentCardStyleDoesNotMatchPrismTokens(t *testing.T) { | |||
| 355 | 355 | } | |
| 356 | 356 | } | |
| 357 | 357 | ||
| 358 | // Sign-in, registration and enrollment are one card on an otherwise empty | ||
| 359 | // page. The card was capped at a readable measure but pinned to the page's left | ||
| 360 | // edge, so a wide window left it far off the center line the topbar and every | ||
| 361 | // other page share. The rule must keep its measure and center its column; the | ||
| 362 | // vertical offset is a judgement call and may be retuned. | ||
| 363 | func TestAuthPagesCenterTheirColumn(t *testing.T) { | ||
| 364 | t.Parallel() | ||
| 365 | f := newFixtureWith(t, func(c *config.Config) { | ||
| 366 | c.PublicURL = "https://forge.test" | ||
| 367 | c.OpenRegistration = true | ||
| 368 | }) | ||
| 369 | |||
| 370 | for _, path := range []string{"/-/login", "/-/register", "/-/invite"} { | ||
| 371 | resp, body := f.browserGet(t, path, "") | ||
| 372 | if resp.StatusCode != http.StatusOK { | ||
| 373 | t.Fatalf("%s = %d", path, resp.StatusCode) | ||
| 374 | } | ||
| 375 | if !strings.Contains(body, `class="auth"`) { | ||
| 376 | t.Errorf("%s does not render its card in the auth column", path) | ||
| 377 | } | ||
| 378 | } | ||
| 379 | |||
| 380 | code, css := f.get("/-/static/vole.css") | ||
| 381 | if code != http.StatusOK { | ||
| 382 | t.Fatalf("stylesheet = %d", code) | ||
| 383 | } | ||
| 384 | at := strings.Index(css, "\n.auth {") | ||
| 385 | if at < 0 { | ||
| 386 | t.Fatal("the stylesheet has no .auth rule") | ||
| 387 | } | ||
| 388 | rule := css[at+1:] | ||
| 389 | rule = rule[:strings.Index(rule, "}")+1] | ||
| 390 | if !strings.Contains(rule, "max-width: 34rem") { | ||
| 391 | t.Errorf(".auth lost its readable measure: %s", rule) | ||
| 392 | } | ||
| 393 | // Centering may be spelled margin-inline: auto or as a shorthand; what it | ||
| 394 | // must not do is drop the auto margin, which pins the column left again. | ||
| 395 | if !strings.Contains(rule, "auto") { | ||
| 396 | t.Errorf(".auth does not center its column: %s", rule) | ||
| 397 | } | ||
| 398 | } | ||
| 399 | |||
| 358 | 400 | // HTMX adds its indicator styles with a <style> element unless told not to. | |
| 359 | 401 | // style-src 'self' blocks that injection, so the shell must carry the config | |
| 360 | 402 | // that turns it off and the stylesheet must carry the rules it would have added. | |