package web import ( "bytes" "strings" "testing" ) // C8 — template smoke for the redesigned NAS page: it renders through the PRODUCTION template tree // and uses the canonical form classes; the nonexistent classes (`form-row`/`form-input`) and the // summary-styled-as-button hack — the root causes of the unstyled look this task fixed — must never // come back. Companion red-proof: reintroduce `class="form-input"` on an input → FAIL. func TestStorageNetworkTemplate_CanonicalClasses(t *testing.T) { s := testServer(t) s.loadTemplates() data := map[string]interface{}{ "Page": "storage-network", "Title": "Hálózati tárhely", "NetAddSupport": "yes", "NetworkStoragePaths": []networkStorageItem{ {Name: "media", Label: "NAS media", Protocol: "nfs", Server: "10.0.0.5", Export: "/srv/media", Path: "/mnt/felhom-drives/media", Health: "ok"}, {Name: "ghost", Label: "Árva megosztás: ghost", Protocol: "nfs", Server: "10.0.0.5", Export: "/srv/ghost", Path: "/mnt/felhom-drives/ghost", Health: "idle", Orphan: true}, }, } var buf bytes.Buffer if err := s.tmpl.ExecuteTemplate(&buf, "storage_network", data); err != nil { t.Fatalf("render storage_network: %v", err) } html := buf.String() for _, want := range []string{ `class="form-control"`, // the canonical input class `class="form-group"`, // the canonical field wrapper "SMB (Synology, QNAP", // protocol-honest ordering: SMB listed first "NFS (TrueNAS, Linux szerver)", // no bare "ajánlott" claim "Árva", // the orphan badge renders "minden felhasználó leképezése", // the Route-A guidance block "ns-hostid", // the live computed host-id span "/api/storage/netstorage/add/status", // the poll-driven progress wiring } { if !strings.Contains(html, want) { t.Errorf("rendered page missing %q", want) } } for _, banned := range []string{ "form-row", // nonexistent class — the old unstyled-look root cause "form-input", // nonexistent class `