Fix UI spacing issues
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user