//go:build browser // The side's fold and rail tooltips in real engines: focus kept across a // fold, tooltips that can be hovered and dismissed, and no fold where // there is none. Not part of `make test`: it needs Node 22+ and // Playwright with its browsers (ESTILO_PLAYWRIGHT names the playwright // package directory when it is not resolvable from here; ESTILO_BROWSERS // picks engines, default "chromium,webkit"). Run it with `make // test-browser`. An engine that will not launch fails the test. // // 2026-11-21, Astra's review of contra-joins-ring: folding left focus on // BODY, the rail's tooltip vanished as the pointer crossed to it and // Escape did not dismiss it, and ⌘\ folded a side drawn with no fold. // The Node test's DOM has neither focus nor CSS; this has both. package side import ( "bytes" "encoding/json" "fmt" "html/template" "net/http" "net/http/httptest" "os" "os/exec" "strings" "testing" "amadan.net/oficina/estilo.git/base" "amadan.net/oficina/estilo.git/chrome" "amadan.net/oficina/estilo.git/menu" "amadan.net/oficina/estilo.git/theme" "github.com/carlosframework/rastrillo/ui" ) const sidePage = `
%s ` type sideCheck struct { Engine string `json:"engine"` Error string `json:"error"` Checks []struct { Name string `json:"name"` Got string `json:"got"` Want string `json:"want"` } `json:"checks"` } func TestFoldAndTooltipsInBrowsers(t *testing.T) { if _, err := exec.LookPath("node"); err != nil { t.Fatal("node is required (Node 22+)") } tmpl := template.Must(template.ParseFS(Templates(), "templates/*.html")) icon := template.HTML(``) mux := http.NewServeMux() mux.HandleFunc("GET /{$}", func(w http.ResponseWriter, r *http.Request) { q := r.URL.Query() s := Side{Label: "App", State: q.Get("state"), Places: []Item{{Href: "/", Label: "Home", Icon: icon, Current: true}, {Href: "/search", Label: "Search", Icon: icon, Key: "⌘K"}}, Sections: []Section{{Heading: "Pinned", Items: []Item{ {Href: "/p/a", Label: "Alpha", Icon: icon, Current: true}}}}, } if q.Get("fold") != "no" { s.Fold = &Fold{Action: "/fold", Return: "/", Hide: "Hide sidebar", Show: "Show sidebar", Cookie: "app-side"} } s.Light() var body bytes.Buffer if q.Get("frame") == "no" { body.WriteString(`Body.