oficina / estilo Public

Clone
git clone https://amadan.net/oficina/estilo

Plain git — no account needed to clone.

Download

Download this file

1package chrome
2
3import (
4 "html/template"
5 "regexp"
6 "strconv"
7 "strings"
8 "testing"
9
10 "amadan.net/oficina/estilo.git/menu"
11)
12
13// What Docs puts in the slots: its own menu bar and its undo/redo pair,
14// markup it rendered itself.
15const (
16 testMenubar = template.HTML(`<nav estilo-menubar aria-label="Menus"><details estilo-menubar-menu name="estilo-menus"><summary estilo-menubar-title>File</summary><div estilo-menu></div></details></nav>`)
17 testLead = template.HTML(`<button type="button" data-docs-command="undo" aria-label="Undo"></button>`)
18)
19
20func stacked() Bar {
21 b := signedIn("x")
22 b.Menubar = testMenubar
23 return b
24}
25
26func header(html string) string { return html[:strings.Index(html, ">")+1] }
27
28// The Menubar slot makes the bar stacked, and only it does: the title and
29// the app's menus share one stack, so the same markup serves the 56px
30// header from 800px and the two-row bar below it.
31func TestTheMenubarSlotStacksTheBar(t *testing.T) {
32 b := stacked()
33 html := render(t, "estilo-bar", b)
34 if got := header(html); got != `<header estilo-bar="stacked">` {
35 t.Errorf("a bar with a menubar opens %s", got)
36 }
37 stack := html[strings.Index(html, "<div estilo-bar-stack>"):strings.Index(html, "<div estilo-bar-end>")]
38 title := strings.Index(stack, "<form estilo-bar-title")
39 menus := strings.Index(stack, "<div estilo-bar-menubar>"+string(testMenubar)+"</div>")
40 if title < 0 || menus < 0 || menus < title {
41 t.Fatalf("the stack is not the title over the app's menubar, verbatim:\n%s", stack)
42 }
43 if strings.Count(html, "estilo-menubar-title") != 1 {
44 t.Error("the menubar is drawn more than once; the narrow row must be the same markup")
45 }
46
47 b.Sticky = true
48 if got := header(render(t, "estilo-bar", b)); got != `<header estilo-bar="sticky stacked">` {
49 t.Errorf("a sticky stacked bar opens %s", got)
50 }
51
52 // A read-only title (a public page) stacks the same way.
53 b.ContextEdit, b.Context = nil, "A document"
54 html = render(t, "estilo-bar", b)
55 if !strings.Contains(html, "<div estilo-bar-stack>\n <span estilo-bar-context dir=\"auto\" title=\"A document\">A document</span>\n <div estilo-bar-menubar>") {
56 t.Errorf("the read-only title is not in the stack:\n%s", html)
57 }
58
59 // Lead alone does not stack the bar, and neither slot set draws no
60 // stack at all.
61 b = signedIn("x")
62 b.Lead = testLead
63 html = render(t, "estilo-bar", b)
64 if strings.Contains(header(html), "stacked") || strings.Contains(html, "estilo-bar-stack") || strings.Contains(html, "estilo-bar-menubar") {
65 t.Errorf("a bar with only a lead is stacked:\n%s", header(html))
66 }
67 html = render(t, "estilo-bar", signedIn("x"))
68 if strings.Contains(html, "stacked") || strings.Contains(html, "estilo-bar-stack") {
69 t.Error("a bar with no slots is stacked")
70 }
71}
72
73// The lead opens the end group, before the actions, at every width, and
74// never goes into the Menu sheet: it is the app's, not an action.
75func TestTheLeadSlotOpensTheEndGroup(t *testing.T) {
76 b := stacked()
77 b.Lead = testLead
78 html := render(t, "estilo-bar", b)
79 end := html[strings.Index(html, "<div estilo-bar-end>"):]
80 if !strings.HasPrefix(end, "<div estilo-bar-end>\n <div estilo-bar-lead>"+string(testLead)+"</div>\n <div estilo-bar-actions>") {
81 t.Errorf("the lead is not first in the end group, before the actions:\n%s", end)
82 }
83 sheet := html[strings.Index(html, `<div estilo-menu="sheet">`):]
84 sheet = sheet[:strings.Index(sheet, "</details>")]
85 if strings.Contains(sheet, "data-docs-command") {
86 t.Error("the lead went into the Menu sheet")
87 }
88 // The end group's order stands with a lead in it.
89 order := []string{"<div estilo-bar-lead>", "<div estilo-bar-actions>", "<details estilo-bar-more", "<details estilo-switcher", "<details estilo-account"}
90 last := -1
91 for _, marker := range order {
92 i := strings.Index(html, marker)
93 if i < 0 || i < last {
94 t.Fatalf("%q is missing or out of order", marker)
95 }
96 last = i
97 }
98}
99
100// Format toggles an inspector that exists only from 64rem: the bar marks
101// it estilo-bar-wide (hidden below 64rem) and the narrow sheet leaves it
102// out. A sheet with nothing left in it is not drawn.
103func TestAWideOnlyActionStaysOutOfTheSheet(t *testing.T) {
104 b := stacked()
105 b.Actions = []Action{
106 {Item: menu.Item{Controls: "docs-inspector", Expanded: true, Label: "x-format"}, WideOnly: true},
107 {Item: menu.Item{Href: "/d/abc/share", Label: "x-share"}, Primary: true},
108 }
109 html := render(t, "estilo-bar", b)
110 actions := html[strings.Index(html, "<div estilo-bar-actions>"):strings.Index(html, "<details estilo-bar-more")]
111 if !strings.Contains(actions, `<div estilo-bar-control="wide"><button rst-btn type="button" aria-expanded="true" aria-controls="docs-inspector" disabled data-estilo-toggle estilo-bar-wide>x-format</button></div>`) {
112 t.Errorf("the wide-only toggle is not marked in the bar:\n%s", actions)
113 }
114 sheet := html[strings.Index(html, `<div estilo-menu="sheet">`):strings.Index(html, "<details estilo-switcher")]
115 if strings.Contains(sheet, "x-format") {
116 t.Errorf("the wide-only action is in the Menu sheet:\n%s", sheet)
117 }
118 if !strings.Contains(sheet, "x-share") {
119 t.Errorf("an ordinary action left the Menu sheet:\n%s", sheet)
120 }
121
122 // Only wide-only actions and no nav: no Menu at all, not an empty one.
123 b.Nav = nil
124 b.Actions = b.Actions[:1]
125 html = render(t, "estilo-bar", b)
126 if strings.Contains(html, "estilo-bar-more") {
127 t.Error("a Menu sheet was drawn with nothing in it")
128 }
129 if !strings.Contains(html, "x-format") {
130 t.Error("the wide-only action left the bar too")
131 }
132 // Nav and only wide-only actions: the nav, and no rule after it.
133 b.Nav = []Link{{Href: "/", Label: "x-nav"}}
134 html = render(t, "estilo-bar", b)
135 if !strings.Contains(html, "estilo-bar-more") {
136 t.Fatal("the nav's Menu sheet is gone")
137 }
138 sheet = html[strings.Index(html, `<div estilo-menu="sheet">`):strings.Index(html, "<details estilo-switcher")]
139 if strings.Contains(sheet, "<hr>") {
140 t.Errorf("the sheet rules off actions it does not hold:\n%s", sheet)
141 }
142
143 // Every kind carries the mark, on its outermost element.
144 for _, it := range []menu.Item{{Href: "/h", Label: "l"}, {Action: "/p", Label: "l"}, {Dialog: "d", Label: "l"}, {Controls: "c", Label: "l"}} {
145 html := render(t, "estilo-bar-action", Action{Item: it, WideOnly: true})
146 if open := html[:strings.Index(html, ">")+1]; !strings.HasSuffix(open, " estilo-bar-wide>") {
147 t.Errorf("%+v: the outermost element %s is not marked", it, open)
148 }
149 }
150}
151
152// The toggle kind in the bar: a button that names its region and its
153// state and is disabled as rendered, until the app's script binds it.
154func TestAToggleActionIsDisabledUntilBound(t *testing.T) {
155 for _, c := range []struct {
156 a Action
157 want string
158 }{
159 {Action{Item: menu.Item{Controls: "docs-inspector", Label: "Format"}}, `<button rst-btn type="button" aria-expanded="false" aria-controls="docs-inspector" disabled data-estilo-toggle>Format</button>`},
160 {Action{Item: menu.Item{Controls: "docs-inspector", Expanded: true, Label: "Format"}}, `<button rst-btn type="button" aria-expanded="true" aria-controls="docs-inspector" disabled data-estilo-toggle>Format</button>`},
161 {Action{Item: menu.Item{Controls: "p", Label: "Panel"}, Primary: true}, `<button rst-btn="primary" type="button" aria-expanded="false" aria-controls="p" disabled data-estilo-toggle>Panel</button>`},
162 } {
163 if got := render(t, "estilo-bar-action", c.a); got != c.want {
164 t.Errorf("got %s\nwant %s", got, c.want)
165 }
166 }
167 // The icon is the app's own markup, drawn before the label in the bar,
168 // whatever kind the action is.
169 icon := template.HTML(`<svg aria-hidden="true"></svg>`)
170 for kind, c := range map[string]struct {
171 item menu.Item
172 want string
173 }{
174 "toggle": {menu.Item{Controls: "c", Label: "Format"}, `data-estilo-toggle><svg aria-hidden="true"></svg>Format</button>`},
175 "link": {menu.Item{Href: "/s", Label: "Format"}, `<a rst-btn href="/s"><svg aria-hidden="true"></svg>Format</a>`},
176 "post": {menu.Item{Action: "/p", Label: "Format"}, `type="submit"><svg aria-hidden="true"></svg>Format</button></form>`},
177 "dialog": {menu.Item{Dialog: "d", Label: "Format"}, `command="show-modal"><svg aria-hidden="true"></svg>Format</button>`},
178 } {
179 if got := render(t, "estilo-bar-action", Action{Item: c.item, Icon: icon}); !strings.HasSuffix(got, c.want) {
180 t.Errorf("%s: the icon is not before the label: %s", kind, got)
181 }
182 }
183}
184
185// In a bar with a slot each action sits in a display: contents wrapper
186// the controls set is styled on (estilo's CSS never selects rst-btn), and
187// the primary one says so. A bar without a slot draws them bare
188// (TestABarWithoutSlotsIsByteForByteUnchanged).
189func TestSlottedBarsWrapEachActionAsAControl(t *testing.T) {
190 for name, b := range map[string]Bar{"menubar": stacked(), "lead": func() Bar { b := signedIn("x"); b.Lead = testLead; return b }()} {
191 html := render(t, "estilo-bar", b)
192 actions := html[strings.Index(html, "<div estilo-bar-actions>"):strings.Index(html, "<details estilo-bar-more")]
193 for _, want := range []string{
194 `<div estilo-bar-control><a rst-btn href="/d/abc/share">x-share</a></div>`,
195 `<div estilo-bar-control="primary"><form method="post" action="/d/new"><button rst-btn="primary" type="submit">x-create</button></form></div>`,
196 } {
197 if !strings.Contains(actions, want) {
198 t.Errorf("%s: the actions lack %s in\n%s", name, want, actions)
199 }
200 }
201 }
202}
203
204// The first paint's width for the title field: a guess in columns, with
205// room to spare, since a guess too wide only leaves the field's edge
206// further out and a guess too narrow cuts the title off with scripts off.
207// A wide or fullwidth character (CJK, kana, Hangul, most emoji) takes two
208// columns and a capital one and a half, and the whole is a quarter wider
209// again; never under 4. Measured at ecb81fc, where Size counted runes:
210// 11 kanji painted 121px against the 206px they need, 20 capital Ws 193px
211// against 326px.
212func TestTheTitleSizeIsItsWidthInColumnsWithAMargin(t *testing.T) {
213 for value, want := range map[string]int{
214 "": 4,
215 "Q3": 4,
216 "Untitled document": 22, // 1 capital + 16: 17.5 columns
217 "Café plans": 14, // 1 capital + 9: 10.5
218 "日本語のタイトル": 20, // 8 wide: 16
219 "Wide": 10, // 4 fullwidth: 8
220 "Plans 🎉🎉🎉": 16, // 1 capital + 5 + 3 wide emoji: 12.5
221 "WWWWWWWWWWWWWWWWWWWW": 38, // 20 capitals: 30
222 "مستند بلا عنوان": 19, // 15: Arabic has no capitals
223 } {
224 if got := (TitleEdit{Value: value}).Size(); got != want {
225 t.Errorf("Size(%q) = %d, want %d", value, got, want)
226 }
227 }
228 b := stacked()
229 b.ContextEdit.Value = "Café plans"
230 html := render(t, "estilo-bar", b)
231 if !strings.Contains(html, `<input estilo-bar-title-input name="title" value="Café plans" size="14" aria-label=`) {
232 t.Errorf("the stacked title has no size from its length:\n%s", html)
233 }
234 // Only a stacked bar sizes its title to the text.
235 if strings.Contains(render(t, "estilo-bar", signedIn("x")), " size=") {
236 t.Error("a one-row bar's title has a size")
237 }
238}
239
240// The two title forms are one form: the fitted one is the plain one plus
241// its size attribute, so they cannot drift apart.
242func TestTheFittedTitleIsTheTitlePlusASize(t *testing.T) {
243 edit := signedIn("x").ContextEdit
244 plain := render(t, "estilo-bar-title", edit)
245 fit := render(t, "estilo-bar-title-fit", edit)
246 if got := strings.Replace(fit, ` size="`+strconv.Itoa(edit.Size())+`"`, "", 1); got != plain {
247 t.Errorf("estilo-bar-title-fit is not estilo-bar-title plus size:\n%s\n%s", fit, plain)
248 }
249}
250
251// The stacked bar's whole markup stays free of script, and every bar
252// trigger, menubar menus included, stays in the one group.
253func TestTheStackedBarKeepsTheOneMenuGroup(t *testing.T) {
254 b := stacked()
255 b.Lead = testLead
256 html := render(t, "estilo-bar", b)
257 if strings.Contains(html, "<script") {
258 t.Fatal("the bar requires no script")
259 }
260 for _, d := range regexp.MustCompile(`<details [^>]*>`).FindAllString(html, -1) {
261 if !strings.Contains(d, `name="estilo-menus"`) {
262 t.Errorf("%s is not in the estilo-menus group", d)
263 }
264 }
265}
266
267// Appearance is three equal segments, an icon over each word, the current
268// one pressed; the form opts out of the busy rule (a view switch holds
269// nothing), and it is still a plain POST form for a page without script.
270func TestAppearanceIsASegmentedSelectorSwitchedInPlace(t *testing.T) {
271 html := render(t, "estilo-account", signedIn("x").Account)
272 form := regexp.MustCompile(`<form estilo-appearance [^>]*>`).FindString(html)
273 if form != `<form estilo-appearance method="post" action="/appearance" role="group" aria-labelledby="estilo-appearance" data-busy="false">` {
274 t.Errorf("the Appearance form opens %q", form)
275 }
276 if !strings.Contains(html, `<input type="hidden" name="return_to" value="/d/abc">`) {
277 t.Error("the Appearance form lost return_to, which the script-off POST needs")
278 }
279 for mode, icon := range map[string]string{"light": `<circle cx="12" cy="12" r="4"/>`, "dark": `<path d="M20.985 12.486`, "system": `<rect width="20" height="14" x="2" y="3" rx="2"/>`} {
280 button := regexp.MustCompile(`<button estilo-menu-item type="submit" name="mode" value="` + mode + `" aria-pressed="(true|false)"><span estilo-appearance-icon aria-hidden="true"><svg [^>]*>(.*?)</svg></span><span estilo-menu-label>x-` + mode + `</span></button>`).FindStringSubmatch(html)
281 if button == nil {
282 t.Errorf("no %s segment with an icon over its word in\n%s", mode, html)
283 continue
284 }
285 if (button[1] == "true") != (mode == "dark") {
286 t.Errorf("%s is aria-pressed=%s; only the current mode is pressed", mode, button[1])
287 }
288 if !strings.HasPrefix(button[2], icon) {
289 t.Errorf("%s has the wrong icon: %s", mode, button[2])
290 }
291 }
292 if strings.Contains(html[strings.Index(html, "<form estilo-appearance"):strings.Index(html, "</form>")], "estilo-menu-check") {
293 t.Error("the segments still carry the check column")
294 }
295}
296
297// The stacked header's public numbers: 56px from 800px, the one-row bar
298// plus its menu row and its 1px bottom border below (85px, as measured in
299// Chromium and WebKit; 84 left the border out), and WideOnly's 64rem. The 32px menubar floor
300// goes only inside the stacked header.
301func TestTheStackedBarPublishesItsHeight(t *testing.T) {
302 src := string(CSS())
303 src = src[strings.Index(src, barStackMarker):]
304 for _, re := range []string{
305 `@media \(min-width: 800px\) \{\s*:root:has\(\[estilo-bar~="stacked"\]\) \{ --estilo-bar-block-size: 56px; \}`,
306 `@media \(max-width: 799\.98px\) \{\s*:root:has\(\[estilo-bar~="stacked"\]\) \{ --estilo-bar-block-size: calc\(3\.25rem \+ 2rem \+ 1px\); \}`,
307 `@media \(max-width: 63\.99rem\) \{\s*\[estilo-bar-actions\] \[estilo-bar-wide\],\s*\[estilo-bar-actions\] \[estilo-bar-control~="wide"\] \{ display: none; \}`,
308 `\[estilo-bar~="stacked"\] \[estilo-menubar\] \{[^}]*min-block-size: 0;`,
309 `\[estilo-bar~="stacked"\] \[estilo-bar-brand\] img \{ inline-size: 32px; block-size: 32px; \}`,
310 `\[estilo-bar~="stacked"\] \[estilo-menubar-menu\] > \[estilo-menu\] \{ inset-block-start: calc\(100% \+ 4\.5px\); \}`,
311 } {
312 if !regexp.MustCompile(re).MatchString(src) {
313 t.Errorf("chrome.css lacks %s", re)
314 }
315 }
316 // Coarse pointers: the menubar titles keep their 24px look but take
317 // 44px of hit area, 16px up and 4px down, with no change to layout.
318 coarse := src[strings.Index(src, "@media (min-width: 800px) {"):]
319 coarse = coarse[strings.Index(coarse, "@media (pointer: coarse) {"):]
320 coarse = coarse[:strings.Index(coarse, "\n }\n")]
321 for _, want := range []string{
322 `[estilo-bar~="stacked"] [estilo-menubar-title] { position: relative; }`,
323 `[estilo-bar~="stacked"] [estilo-menubar-title]::before { content: ""; position: absolute; inset-inline: 0; inset-block: -16px -4px; }`,
324 `[estilo-bar~="stacked"] [estilo-bar-title] { z-index: 1; }`, // the title field keeps its own 24px on top
325 } {
326 if !strings.Contains(coarse, want) {
327 t.Errorf("the coarse-pointer rules lack %s", want)
328 }
329 }
330 // Coarse pointers raise the controls to 32px.
331 if !regexp.MustCompile(`@media \(pointer: coarse\) \{\s*:is\(\[estilo-bar-control\] > a, [^)]*\) \{ block-size: 32px; min-block-size: 32px; \}`).MatchString(src) {
332 t.Error("the controls do not rise to 32px on a coarse pointer")
333 }
334}
335
336// A stacked title's field is sized to its title, from a guess before the
337// script runs: an ellipsis there would say the title was cut short when
338// only the guess was. The one-row bar keeps its ellipsis.
339func TestAStackedTitleNeverShowsAnEllipsis(t *testing.T) {
340 src := string(CSS())
341 if !regexp.MustCompile(`\n\[estilo-bar~="stacked"\] \[estilo-bar-title-input\] \{[^}]*text-overflow: clip;`).MatchString(src[strings.Index(src, barStackMarker):]) {
342 t.Error("the stacked title field still ends a short guess with an ellipsis")
343 }
344}
345
346// Forced colours drop the controls' fills and shadows, so their border is
347// all that is left to draw them, and rastrillo's forced-colors border on
348// [rst-btn] loses to the controls set's border: 0. The set restores it
349// itself, after that rule and at its weight, and marks an expanded toggle
350// (Format with the inspector open) in Highlight, since its tint is gone.
351func TestTheControlsKeepTheirBoundaryInForcedColours(t *testing.T) {
352 src := string(CSS())
353 src = src[strings.Index(src, barStackMarker):]
354 controls := `:is([estilo-bar-control] > a, [estilo-bar-control] > button, [estilo-bar-control] > form > button)`
355 set := strings.Index(src, controls+" {\n display: inline-flex;")
356 at := strings.Index(src, "@media (forced-colors: active) {")
357 if set < 0 || at < 0 || at < set {
358 t.Fatal("no forced-colors block after the controls set's rules")
359 }
360 block := src[at:]
361 block = block[:strings.Index(block, "\n}\n")]
362 for _, want := range []string{
363 controls + " { border: 1px solid ButtonBorder; }",
364 controls + `[aria-expanded="true"] { border-color: Highlight; }`,
365 controls + `[aria-expanded="true"]:not(:focus-visible) { outline: 1px solid Highlight; }`,
366 } {
367 if !strings.Contains(block, want) {
368 t.Errorf("the forced-colors block lacks %s in\n%s", want, block)
369 }
370 }
371}
372
373// From 800px the title field is pulled back by its padding and border
374// (a negative start margin), so its form is that much narrower than the
375// field, and a cap of 100% of the form trimmed chrome.js's fitted width
376// by 7.4px. The cap allows for the margin, so the fit stands as measured.
377func TestTheWideTitleCapAllowsForItsPulledBackMargin(t *testing.T) {
378 src := string(CSS())
379 src = src[strings.Index(src, barStackMarker):]
380 wide := src[strings.Index(src, "@media (min-width: 800px) {"):]
381 rule := regexp.MustCompile(`\[estilo-bar~="stacked"\] \[estilo-bar-title-input\] \{[^}]*\}`).FindString(wide)
382 if !strings.Contains(rule, "margin-inline-start: calc(-1 * var(--rst-sp-2) - 1px);") || !strings.Contains(rule, "max-inline-size: calc(100% + var(--rst-sp-2) + 1px);") {
383 t.Errorf("the wide title field's cap does not give back its pulled-back margin:\n%s", rule)
384 }
385}
386
387// An icon-only action (Mapa's and Fichas' Search) shows its icon alone in
388// the bar: its label is the accessible name and, with its key, the
389// tooltip; its shortcut is aria-keyshortcuts. The Menu sheet's row keeps
390// the label and the key. Every kind draws it the same way.
391func TestAnIconOnlyActionIsNamedButShowsNoText(t *testing.T) {
392 icon := template.HTML(`<svg aria-hidden="true"></svg>`)
393 search := Action{Item: menu.Item{Href: "/search", Label: "x-search", Key: "⌘K"},
394 Icon: icon, IconOnly: true, KeyShortcuts: "Meta+K Control+K"}
395 // html/template writes + as &#43;; the attribute's value is Meta+K.
396 want := `<a rst-btn href="/search" aria-keyshortcuts="Meta&#43;K Control&#43;K" aria-label="x-search" estilo-bar-icon rst-tip data-tip="x-search ⌘K"><svg aria-hidden="true"></svg></a>`
397 if got := render(t, "estilo-bar-action", search); got != want {
398 t.Errorf("got %s\nwant %s", got, want)
399 }
400
401 b := stacked()
402 b.Actions = []Action{search}
403 html := render(t, "estilo-bar", b)
404 actions := html[strings.Index(html, "<div estilo-bar-actions>"):strings.Index(html, "<details estilo-bar-more")]
405 if !strings.Contains(actions, `<div estilo-bar-control>`+want+`</div>`) {
406 t.Errorf("the bar does not draw the icon-only control:\n%s", actions)
407 }
408 sheet := html[strings.Index(html, `<div estilo-menu="sheet">`):strings.Index(html, "<details estilo-switcher")]
409 if !strings.Contains(sheet, `<span estilo-menu-label>x-search</span><kbd estilo-menu-key>⌘K</kbd>`) {
410 t.Errorf("the sheet's row lost its label or key:\n%s", sheet)
411 }
412
413 // No key: the tooltip is the label alone.
414 noKey := search
415 noKey.Key, noKey.KeyShortcuts = "", ""
416 if got := render(t, "estilo-bar-action", noKey); !strings.Contains(got, ` aria-label="x-search" estilo-bar-icon rst-tip data-tip="x-search">`) || strings.Contains(got, "aria-keyshortcuts") {
417 t.Errorf("without a key: %s", got)
418 }
419
420 // IconOnly with no icon would be an empty control: the label shows.
421 if got := render(t, "estilo-bar-action", Action{Item: menu.Item{Href: "/s", Label: "x-search"}, IconOnly: true}); got != `<a rst-btn href="/s">x-search</a>` {
422 t.Errorf("IconOnly without an icon: %s", got)
423 }
424
425 for _, it := range []menu.Item{{Action: "/p", Label: "l"}, {Dialog: "d", Label: "l"}, {Controls: "c", Label: "l"}} {
426 got := render(t, "estilo-bar-action", Action{Item: it, Icon: icon, IconOnly: true})
427 if !strings.Contains(got, ` aria-label="l" estilo-bar-icon rst-tip data-tip="l"><svg aria-hidden="true"></svg></button>`) {
428 t.Errorf("%+v: %s", it, got)
429 }
430 }
431}
432