package console import ( "io/fs" "regexp" "strings" "testing" ) // The switcher's chrome is drawn, not typed: the disclosure caret and the // menu's marks are inline SVG from icons.go, and the text glyphs they replace // ("▾", "✓") are gone from the header. A glyph is whatever the reader's font // decides it is — a caret that renders as a black triangle on one machine and // a coloured emoji on another is not a control, and neither size nor colour // obeys the page. An icon does both. func TestSwitcherChromeIsInlineSVGNotTextGlyphs(t *testing.T) { fx := newConsoleFixture(t) c := signInPaul(t, fx) _, _, body := get(t, c, fx.u("/")) h := header(t, body) summary, _, ok := strings.Cut(h, "") if !ok { t.Fatalf("no in the header:\n%s", h) } // The trigger's caret: a real , in the vendored idiom, hidden from // assistive tech because the account name beside it is the label. if !strings.Contains(summary, " caret:\n%s", summary) } for _, want := range []string{`viewBox="0 0 24 24"`, `stroke="currentColor"`, `aria-hidden="true"`} { if !strings.Contains(summary, want) { t.Errorf("the caret svg is missing %s:\n%s", want, summary) } } // The menu marks the current account and offers a new one, both with // icons rather than a reused tick character. if n := strings.Count(h, "") if !ok { t.Fatalf("no