a65dcff85a
Kills the details/summary-button hack and the nonexistent form-row/form-input classes (the unstyled-look root cause); rebuilds on the storage_attach pattern (settings-card / form-group / form-control / form-actions / alert-*). SMB listed first (consumer reality), NFS two-recipe guidance (map-all-users simple recipe + full-fidelity anonuid=<uid+100000> with a live computed host-id), §3.2 staged poll progress (Kapcsolódás/Csatolási teszt/Írásteszt/Regisztrálás), categorized Hungarian errors with a collapsible raw-detail block, orphan rows with an Árva badge + remove-only action. C8 render smoke guards the class regression. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PSK5g6qYLknKj8u3QAFEr6
57 lines
2.3 KiB
Go
57 lines
2.3 KiB
Go
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",
|
|
"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
|
|
`<summary class="btn`, // the summary-styled-as-button hack
|
|
} {
|
|
if strings.Contains(html, banned) {
|
|
t.Errorf("rendered page still contains the banned pattern %q", banned)
|
|
}
|
|
}
|
|
// The orphan row renders with ONLY the remove action (no attach/migrate verbs anywhere near it).
|
|
if !strings.Contains(html, "Eltávolítás") {
|
|
t.Error("remove action missing")
|
|
}
|
|
}
|