The HTML editor's selection was invisible: CodeMirror's focused-selection rule outranked ours and painted #233, and the opaque active line covered the selection layer. Match its selector and make the active line translucent. Unsaved HTML now saves on leaving a box (selecting another, clicking empty canvas, Done, closing the panel) instead of asking to discard. /shrines is no longer a hard-coded route but an ordinary canvas page, with links placed by hand as Link boxes; the backend no longer reserves the slug. The Shrine starter layout is gone, and the admin Pages tab gains a "New shrine" form that makes a blank page under shrines/. Co-Authored-By: Claude Opus 5.5 <[email protected]>
34 lines
1.0 KiB
Go
34 lines
1.0 KiB
Go
package graph
|
|
|
|
import "testing"
|
|
|
|
func TestValidateSlug(t *testing.T) {
|
|
for _, c := range []struct {
|
|
slug string
|
|
ok bool
|
|
}{
|
|
{"notes-to-self", true},
|
|
{"shrines/evangelion", true},
|
|
{"shrines/neon-genesis/rei2", true},
|
|
{"", false},
|
|
{"Shrines/GTO", false}, // upper case
|
|
{"shrines/", false}, // empty segment
|
|
{"/shrines/gto", false}, // leading slash
|
|
{"shrines//gto", false}, // empty segment
|
|
{"shrines/gto-", false}, // trailing hyphen
|
|
{"shrines/../admin", false}, // dots
|
|
{"shrines", true}, // the index is a canvas page too
|
|
{"shrines/demoman", true}, // no longer an SPA route
|
|
{"admin/pages", false}, // under an SPA route
|
|
{"jobs/x", false}, // under an nginx route
|
|
{"stp", false}, // a built-in canvas's key
|
|
{"index", false}, // likewise
|
|
{"stp-fan-page", true}, // only whole segments are reserved
|
|
} {
|
|
err := validateSlug(c.slug)
|
|
if (err == nil) != c.ok {
|
|
t.Errorf("validateSlug(%q) = %v, want ok=%v", c.slug, err, c.ok)
|
|
}
|
|
}
|
|
}
|