Fix UI spacing issues

This commit is contained in:
2026-09-13 10:49:39 +02:00
parent 3d8d1e5a66
commit adf118385a
4 changed files with 48 additions and 7 deletions
+16 -1
View File
@@ -1458,6 +1458,21 @@ func (h *harness) postForm(t *testing.T, path string, form url.Values, cookie *h
// The delete token is shown once and then has to be usable somewhere. The info
// page is the link an uploader would have kept, so the form lives there.
// detailsIsOpen reports whether the page's first <details> is rendered open,
// by reading the attribute rather than matching the whole tag: the element
// carries classes too, and styling it must not be able to fail this.
func detailsIsOpen(page string) bool {
start := strings.Index(page, "<details")
if start < 0 {
return false
}
end := strings.Index(page[start:], ">")
if end < 0 {
return false
}
return strings.Contains(page[start:start+end], " open")
}
func TestInfoPageAcceptsTheDeleteToken(t *testing.T) {
h := newHarness(t, nil)
res := decode[uploadResult](t, h.upload(t, []byte("x"), nil))
@@ -1510,7 +1525,7 @@ func TestWrongDeleteTokenReturnsToTheInfoPage(t *testing.T) {
if !strings.Contains(page, "not correct") {
t.Error("the page does not say what went wrong")
}
if !strings.Contains(page, "<details open>") {
if !detailsIsOpen(page) {
t.Error("the delete section is collapsed, hiding the error")
}
if _, err := h.store.Get(res.ID, h.now); err != nil {