BlueGit

timfa bluegit

Merge branch 'stage'

timfa Grok Bot · pushed by timfa

Authored 2026-11-17 · 11 hours ago

Hash
3d18c8d8d7af7d30f7bba115c6cb58067b78eb0f
Pipeline
Passed
5 files changed +120 −8
internal/runnercfg/tip.go +1 −1
@@ -16,5 +16,5 @@ func Tip(lang i18n.Lang, key string) template.HTML {
16 16 id := "tip-" + strings.NewReplacer(".", "-", "_", "-").Replace(key)
17 17 text := template.HTMLEscapeString(i18n.T(lang, key))
18 18 info := template.HTMLEscapeString(i18n.T(lang, "tip.info"))
19 return template.HTML(`<span class="tip"><span class="tip-i" role="button" tabindex="0" aria-expanded="false" aria-label="` + info + `" aria-describedby="` + id + `">i</span><span class="tip-b" role="tooltip" id="` + id + `">` + text + `</span></span>`)
19 return template.HTML(`<span class="tip"><span class="tip-i" role="button" tabindex="0" aria-expanded="false" aria-label="` + info + `" aria-describedby="` + id + `">i</span><span class="tip-b" role="tooltip" id="` + id + `" title="` + text + `">` + text + `</span></span>`)
20 20 }
@@ -16,5 +16,5 @@ func Tip(lang i18n.Lang, key string) template.HTML {
16 id := "tip-" + strings.NewReplacer(".", "-", "_", "-").Replace(key)
16 id := "tip-" + strings.NewReplacer(".", "-", "_", "-").Replace(key)
17 text := template.HTMLEscapeString(i18n.T(lang, key))
17 text := template.HTMLEscapeString(i18n.T(lang, key))
18 info := template.HTMLEscapeString(i18n.T(lang, "tip.info"))
18 info := template.HTMLEscapeString(i18n.T(lang, "tip.info"))
19 return template.HTML(`<span class="tip"><span class="tip-i" role="button" tabindex="0" aria-expanded="false" aria-label="` + info + `" aria-describedby="` + id + `">i</span><span class="tip-b" role="tooltip" id="` + id + `">` + text + `</span></span>`)
19 return template.HTML(`<span class="tip"><span class="tip-i" role="button" tabindex="0" aria-expanded="false" aria-label="` + info + `" aria-describedby="` + id + `">i</span><span class="tip-b" role="tooltip" id="` + id + `" title="` + text + `">` + text + `</span></span>`)
20}
20}
internal/runnercfg/tip_test.go +6 −1
@@ -32,7 +32,12 @@ func TestEverySettingHasTip(t *testing.T) {
32 32 }
33 33 }
34 34 }
35 if !strings.Contains(string(Tip(i18n.NL, "rui.tip.name")), `role="tooltip"`) {
35 html := string(Tip(i18n.NL, "rui.tip.name"))
36 if !strings.Contains(html, `role="tooltip"`) {
36 37 t.Fatal("tip zonder role")
37 38 }
39 text := i18n.T(i18n.NL, "rui.tip.name")
40 if !strings.Contains(html, `title="`+text+`"`) {
41 t.Fatalf("tip-b mist title met de volledige tekst: %s", html)
42 }
38 43 }
@@ -32,7 +32,12 @@ func TestEverySettingHasTip(t *testing.T) {
32 }
32 }
33 }
33 }
34 }
34 }
35 if !strings.Contains(string(Tip(i18n.NL, "rui.tip.name")), `role="tooltip"`) {
35 html := string(Tip(i18n.NL, "rui.tip.name"))
36 if !strings.Contains(html, `role="tooltip"`) {
36 t.Fatal("tip zonder role")
37 t.Fatal("tip zonder role")
37 }
38 }
39 text := i18n.T(i18n.NL, "rui.tip.name")
40 if !strings.Contains(html, `title="`+text+`"`) {
41 t.Fatalf("tip-b mist title met de volledige tekst: %s", html)
42 }
38}
43}
internal/server/static/float.js +1 −0
@@ -159,6 +159,7 @@
159 159 }
160 160 tipAnchor = el;
161 161 tip.textContent = text;
162 tip.setAttribute("title", text);
162 163 tip.classList.toggle("heat", el.classList.contains("sq"));
163 164 openLayer(tip);
164 165 track(tip, el, "above-center");
@@ -159,6 +159,7 @@
159 }
159 }
160 tipAnchor = el;
160 tipAnchor = el;
161 tip.textContent = text;
161 tip.textContent = text;
162 tip.setAttribute("title", text);
162 tip.classList.toggle("heat", el.classList.contains("sq"));
163 tip.classList.toggle("heat", el.classList.contains("sq"));
163 openLayer(tip);
164 openLayer(tip);
164 track(tip, el, "above-center");
165 track(tip, el, "above-center");
internal/server/static/style.css +19 −6
@@ -256,8 +256,7 @@ td, th { text-align: left; padding: var(--sp-2) var(--sp-3); border-bottom: 1px
256 256 }
257 257 .menu-panel[popover]:popover-open,
258 258 .showid form[popover]:popover-open,
259 .stage-pop:popover-open,
260 .float-tip:popover-open {
259 .stage-pop:popover-open {
261 260 position: fixed;
262 261 inset: auto;
263 262 margin: 0;
@@ -780,9 +779,23 @@ button.stage-dot {
780 779 }
781 780 .stage.open button.stage-dot { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1f75cb; }
782 781 .float-tip {
783 border: 0; padding: 0.28rem 0.5rem; border-radius: 6px;
782 box-sizing: border-box; border: 0; padding: 0.28rem 0.5rem; border-radius: 6px;
784 783 background: #24292f; color: white; font-size: 0.75rem; font-weight: 600;
785 line-height: 1.2; white-space: nowrap; pointer-events: none;
784 line-height: 1.35; white-space: normal; overflow-wrap: anywhere;
785 overflow: hidden; text-overflow: ellipsis; pointer-events: none;
786 display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
787 max-width: min(26rem, calc(100vw - 2rem));
788 max-height: calc(2 * 1.35em + 0.56rem);
789 }
790 .float-tip:popover-open {
791 position: fixed;
792 inset: auto;
793 margin: 0;
794 width: max-content;
795 max-width: min(26rem, calc(100vw - 2rem));
796 height: auto;
797 display: -webkit-box;
798 overflow: hidden;
786 799 }
787 800 .float-tip.heat { background: #142033; font-size: 0.78rem; font-weight: 400; }
788 801 .stage-pop {
@@ -1513,9 +1526,9 @@ html.bgmodal-open { overflow: hidden; }
1513 1526 .tip { display: inline-flex; vertical-align: middle; margin-left: 4px; }
1514 1527 .tip-i { all: unset; display: inline-block; box-sizing: border-box; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--blue); color: var(--blue-deep); background: var(--blue-soft); font: italic 700 11px/16px Georgia, serif; text-align: center; cursor: help; flex: none; }
1515 1528 .tip-i:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
1516 .tip-b { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-width: 26rem; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius); background: var(--ink); color: #fff; font-size: var(--fs-sm); font-weight: 400; font-style: normal; line-height: 1.45; box-shadow: var(--shadow); white-space: normal; text-align: left; overflow-wrap: anywhere; }
1529 .tip-b { display: none; box-sizing: border-box; position: absolute; left: 0; top: calc(100% + 4px); z-index: 30; width: max-content; max-width: min(26rem, calc(100vw - 2rem)); max-height: calc(2 * 1.45em + 2 * var(--sp-2)); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius); background: var(--ink); color: #fff; font-size: var(--fs-sm); font-weight: 400; font-style: normal; line-height: 1.45; box-shadow: var(--shadow); white-space: normal; text-align: left; overflow-wrap: anywhere; overflow: hidden; text-overflow: ellipsis; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
1517 1530 .tip-b::before { content: ""; position: absolute; top: -5px; left: 14px; border: 5px solid transparent; border-top: 0; border-bottom-color: var(--ink); }
1518 .tip:hover .tip-b, .tip-i:focus + .tip-b, .tip.open .tip-b, .tiphost:focus-within .tip-b { display: block; }
1531 .tip:hover .tip-b, .tip-i:focus + .tip-b, .tip.open .tip-b, .tiphost:focus-within .tip-b { display: -webkit-box; overflow: hidden; }
1519 1532 .tiphost:has(.tip.open), .tiphost:focus-within, .tiphost:hover { z-index: 31; }
1520 1533
1521 1534 /* Taalkiezer (langpick.js) */
@@ -256,8 +256,7 @@ td, th { text-align: left; padding: var(--sp-2) var(--sp-3); border-bottom: 1px
256}
256}
257.menu-panel[popover]:popover-open,
257.menu-panel[popover]:popover-open,
258.showid form[popover]:popover-open,
258.showid form[popover]:popover-open,
259.stage-pop:popover-open,
259.stage-pop:popover-open {
260.float-tip:popover-open {
261 position: fixed;
260 position: fixed;
262 inset: auto;
261 inset: auto;
263 margin: 0;
262 margin: 0;
@@ -780,9 +779,23 @@ button.stage-dot {
780}
779}
781.stage.open button.stage-dot { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1f75cb; }
780.stage.open button.stage-dot { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1f75cb; }
782.float-tip {
781.float-tip {
783 border: 0; padding: 0.28rem 0.5rem; border-radius: 6px;
782 box-sizing: border-box; border: 0; padding: 0.28rem 0.5rem; border-radius: 6px;
784 background: #24292f; color: white; font-size: 0.75rem; font-weight: 600;
783 background: #24292f; color: white; font-size: 0.75rem; font-weight: 600;
785 line-height: 1.2; white-space: nowrap; pointer-events: none;
784 line-height: 1.35; white-space: normal; overflow-wrap: anywhere;
785 overflow: hidden; text-overflow: ellipsis; pointer-events: none;
786 display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
787 max-width: min(26rem, calc(100vw - 2rem));
788 max-height: calc(2 * 1.35em + 0.56rem);
789}
790.float-tip:popover-open {
791 position: fixed;
792 inset: auto;
793 margin: 0;
794 width: max-content;
795 max-width: min(26rem, calc(100vw - 2rem));
796 height: auto;
797 display: -webkit-box;
798 overflow: hidden;
786}
799}
787.float-tip.heat { background: #142033; font-size: 0.78rem; font-weight: 400; }
800.float-tip.heat { background: #142033; font-size: 0.78rem; font-weight: 400; }
788.stage-pop {
801.stage-pop {
@@ -1513,9 +1526,9 @@ html.bgmodal-open { overflow: hidden; }
1513.tip { display: inline-flex; vertical-align: middle; margin-left: 4px; }
1526.tip { display: inline-flex; vertical-align: middle; margin-left: 4px; }
1514.tip-i { all: unset; display: inline-block; box-sizing: border-box; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--blue); color: var(--blue-deep); background: var(--blue-soft); font: italic 700 11px/16px Georgia, serif; text-align: center; cursor: help; flex: none; }
1527.tip-i { all: unset; display: inline-block; box-sizing: border-box; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--blue); color: var(--blue-deep); background: var(--blue-soft); font: italic 700 11px/16px Georgia, serif; text-align: center; cursor: help; flex: none; }
1515.tip-i:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
1528.tip-i:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
1516.tip-b { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-width: 26rem; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius); background: var(--ink); color: #fff; font-size: var(--fs-sm); font-weight: 400; font-style: normal; line-height: 1.45; box-shadow: var(--shadow); white-space: normal; text-align: left; overflow-wrap: anywhere; }
1529.tip-b { display: none; box-sizing: border-box; position: absolute; left: 0; top: calc(100% + 4px); z-index: 30; width: max-content; max-width: min(26rem, calc(100vw - 2rem)); max-height: calc(2 * 1.45em + 2 * var(--sp-2)); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius); background: var(--ink); color: #fff; font-size: var(--fs-sm); font-weight: 400; font-style: normal; line-height: 1.45; box-shadow: var(--shadow); white-space: normal; text-align: left; overflow-wrap: anywhere; overflow: hidden; text-overflow: ellipsis; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
1517.tip-b::before { content: ""; position: absolute; top: -5px; left: 14px; border: 5px solid transparent; border-top: 0; border-bottom-color: var(--ink); }
1530.tip-b::before { content: ""; position: absolute; top: -5px; left: 14px; border: 5px solid transparent; border-top: 0; border-bottom-color: var(--ink); }
1518.tip:hover .tip-b, .tip-i:focus + .tip-b, .tip.open .tip-b, .tiphost:focus-within .tip-b { display: block; }
1531.tip:hover .tip-b, .tip-i:focus + .tip-b, .tip.open .tip-b, .tiphost:focus-within .tip-b { display: -webkit-box; overflow: hidden; }
1519.tiphost:has(.tip.open), .tiphost:focus-within, .tiphost:hover { z-index: 31; }
1532.tiphost:has(.tip.open), .tiphost:focus-within, .tiphost:hover { z-index: 31; }
1520
1533
1521/* Taalkiezer (langpick.js) */
1534/* Taalkiezer (langpick.js) */
internal/server/tooltip_css_test.go added +93 −0
@@ -0,0 +1,93 @@
1 package server
2
3 import (
4 "os"
5 "regexp"
6 "strings"
7 "testing"
8 )
9
10 // ruleBlock geeft de inhoud van de eerste CSS-regel die met sel begint.
11 func ruleBlock(css, sel string) string {
12 i := strings.Index(css, sel+" {")
13 if i < 0 {
14 i = strings.Index(css, sel+"{")
15 }
16 if i < 0 {
17 return ""
18 }
19 rest := css[i:]
20 start := strings.Index(rest, "{")
21 end := strings.Index(rest, "}")
22 if start < 0 || end < 0 || end < start {
23 return ""
24 }
25 return rest[start+1 : end]
26 }
27
28 func TestTooltipCSSWrapsTwoLinesWithoutScrollbar(t *testing.T) {
29 css, err := os.ReadFile("static/style.css")
30 if err != nil {
31 t.Fatal(err)
32 }
33 src := string(css)
34 for _, sel := range []string{".float-tip", ".float-tip:popover-open", ".tip-b"} {
35 body := ruleBlock(src, sel)
36 if body == "" {
37 t.Fatalf("regel %s ontbreekt", sel)
38 }
39 if strings.Contains(body, "white-space: nowrap") {
40 t.Errorf("%s heeft white-space: nowrap; tekst moet wrappen", sel)
41 }
42 if strings.Contains(body, "overflow: auto") || strings.Contains(body, "overflow-x: auto") || strings.Contains(body, "overflow-x: scroll") || strings.Contains(body, "overflow: scroll") {
43 t.Errorf("%s mag geen scrollbar krijgen: %s", sel, body)
44 }
45 }
46 ft := ruleBlock(src, ".float-tip")
47 for _, want := range []string{
48 "white-space: normal",
49 "overflow: hidden",
50 "-webkit-line-clamp: 2",
51 "line-clamp: 2",
52 "overflow-wrap: anywhere",
53 "box-sizing: border-box",
54 "max-width: min(26rem, calc(100vw - 2rem))",
55 } {
56 if !strings.Contains(ft, want) {
57 t.Errorf(".float-tip mist %q", want)
58 }
59 }
60 open := ruleBlock(src, ".float-tip:popover-open")
61 if !strings.Contains(open, "overflow: hidden") || !strings.Contains(open, "display: -webkit-box") {
62 t.Errorf(".float-tip:popover-open moet wrappen zonder scrollbar: %s", open)
63 }
64 tb := ruleBlock(src, ".tip-b")
65 for _, want := range []string{"white-space: normal", "overflow: hidden", "-webkit-line-clamp: 2", "line-clamp: 2", "max-width: min(26rem, calc(100vw - 2rem))"} {
66 if !strings.Contains(tb, want) {
67 t.Errorf(".tip-b mist %q", want)
68 }
69 }
70 shown := ruleBlock(src, ".tip:hover .tip-b, .tip-i:focus + .tip-b, .tip.open .tip-b, .tiphost:focus-within .tip-b")
71 if !strings.Contains(shown, "display: -webkit-box") {
72 t.Errorf("zichtbare .tip-b moet -webkit-box zijn voor line-clamp: %s", shown)
73 }
74 // Geen latere .float-tip-regel die nowrap terugzet.
75 re := regexp.MustCompile(`(?s)\.float-tip[^{]*\{[^}]*white-space:\s*nowrap`)
76 if re.MatchString(src) {
77 t.Fatal("ergens zet een .float-tip-regel white-space weer op nowrap")
78 }
79 }
80
81 func TestFloatTipSetsFullTitle(t *testing.T) {
82 js, err := os.ReadFile("static/float.js")
83 if err != nil {
84 t.Fatal(err)
85 }
86 src := string(js)
87 if !strings.Contains(src, `tip.setAttribute("title", text)`) {
88 t.Fatal("float-tip moet de volledige tekst in title zetten")
89 }
90 if !strings.Contains(src, `tip.textContent = text`) {
91 t.Fatal("float-tip toont de tekst")
92 }
93 }
@@ -0,0 +1,93 @@
1package server
2
3import (
4 "os"
5 "regexp"
6 "strings"
7 "testing"
8)
9
10// ruleBlock geeft de inhoud van de eerste CSS-regel die met sel begint.
11func ruleBlock(css, sel string) string {
12 i := strings.Index(css, sel+" {")
13 if i < 0 {
14 i = strings.Index(css, sel+"{")
15 }
16 if i < 0 {
17 return ""
18 }
19 rest := css[i:]
20 start := strings.Index(rest, "{")
21 end := strings.Index(rest, "}")
22 if start < 0 || end < 0 || end < start {
23 return ""
24 }
25 return rest[start+1 : end]
26}
27
28func TestTooltipCSSWrapsTwoLinesWithoutScrollbar(t *testing.T) {
29 css, err := os.ReadFile("static/style.css")
30 if err != nil {
31 t.Fatal(err)
32 }
33 src := string(css)
34 for _, sel := range []string{".float-tip", ".float-tip:popover-open", ".tip-b"} {
35 body := ruleBlock(src, sel)
36 if body == "" {
37 t.Fatalf("regel %s ontbreekt", sel)
38 }
39 if strings.Contains(body, "white-space: nowrap") {
40 t.Errorf("%s heeft white-space: nowrap; tekst moet wrappen", sel)
41 }
42 if strings.Contains(body, "overflow: auto") || strings.Contains(body, "overflow-x: auto") || strings.Contains(body, "overflow-x: scroll") || strings.Contains(body, "overflow: scroll") {
43 t.Errorf("%s mag geen scrollbar krijgen: %s", sel, body)
44 }
45 }
46 ft := ruleBlock(src, ".float-tip")
47 for _, want := range []string{
48 "white-space: normal",
49 "overflow: hidden",
50 "-webkit-line-clamp: 2",
51 "line-clamp: 2",
52 "overflow-wrap: anywhere",
53 "box-sizing: border-box",
54 "max-width: min(26rem, calc(100vw - 2rem))",
55 } {
56 if !strings.Contains(ft, want) {
57 t.Errorf(".float-tip mist %q", want)
58 }
59 }
60 open := ruleBlock(src, ".float-tip:popover-open")
61 if !strings.Contains(open, "overflow: hidden") || !strings.Contains(open, "display: -webkit-box") {
62 t.Errorf(".float-tip:popover-open moet wrappen zonder scrollbar: %s", open)
63 }
64 tb := ruleBlock(src, ".tip-b")
65 for _, want := range []string{"white-space: normal", "overflow: hidden", "-webkit-line-clamp: 2", "line-clamp: 2", "max-width: min(26rem, calc(100vw - 2rem))"} {
66 if !strings.Contains(tb, want) {
67 t.Errorf(".tip-b mist %q", want)
68 }
69 }
70 shown := ruleBlock(src, ".tip:hover .tip-b, .tip-i:focus + .tip-b, .tip.open .tip-b, .tiphost:focus-within .tip-b")
71 if !strings.Contains(shown, "display: -webkit-box") {
72 t.Errorf("zichtbare .tip-b moet -webkit-box zijn voor line-clamp: %s", shown)
73 }
74 // Geen latere .float-tip-regel die nowrap terugzet.
75 re := regexp.MustCompile(`(?s)\.float-tip[^{]*\{[^}]*white-space:\s*nowrap`)
76 if re.MatchString(src) {
77 t.Fatal("ergens zet een .float-tip-regel white-space weer op nowrap")
78 }
79}
80
81func TestFloatTipSetsFullTitle(t *testing.T) {
82 js, err := os.ReadFile("static/float.js")
83 if err != nil {
84 t.Fatal(err)
85 }
86 src := string(js)
87 if !strings.Contains(src, `tip.setAttribute("title", text)`) {
88 t.Fatal("float-tip moet de volledige tekst in title zetten")
89 }
90 if !strings.Contains(src, `tip.textContent = text`) {
91 t.Fatal("float-tip toont de tekst")
92 }
93}