Files
felhom-controller/controller/internal/web/r567_storage_wizard_nav_test.go
T

28 lines
1.1 KiB
Go

package web
import (
"net/http/httptest"
"strings"
"testing"
)
// R-567: the two drive wizard pages pass their TEMPLATE name as Page, and the sidebar's storage
// group only knew "storage" / "storage-network" — so on /storage/init and /storage/attach the
// Tárhely group was closed and nothing was highlighted, as if the household had left the section.
// Asserted through the real handler and the real layout.
func TestStorageWizardPages_OpenTheStorageNavGroup(t *testing.T) {
s := testServer(t)
s.loadTemplates()
for _, page := range []string{"storage_init", "storage_attach"} {
rr := httptest.NewRecorder()
s.storageWizardPageHandler(rr, httptest.NewRequest("GET", "/storage/init", nil), page)
body := rr.Body.String()
if !strings.Contains(body, `<li class="nav-group is-open">`) || !strings.Contains(body, `aria-expanded="true" aria-controls="nav-group-storage"`) {
t.Errorf("R-567 %s: the storage menu group is not open", page)
}
if !strings.Contains(body, `<a href="/storage" class="active">`) {
t.Errorf("R-567 %s: the drives link (/storage) is not marked active", page)
}
}
}