3x-ui/web/login_template_test.go
2026-04-08 15:18:00 +08:00

28 lines
612 B
Go

package web
import (
"strings"
"testing"
)
func TestLoginTemplateRebuildsTurnstileAfterTabSwitch(t *testing.T) {
content, err := htmlFS.ReadFile("html/login.html")
if err != nil {
t.Fatalf("read login template: %v", err)
}
source := string(content)
checks := []string{
"turnstileContainer = null;",
"turnstile.remove(turnstileWidgetId);",
"turnstileContainer !== container",
"turnstileToken = '';",
}
for _, check := range checks {
if !strings.Contains(source, check) {
t.Fatalf("expected login template to contain %q so turnstile can be rebuilt after tab switches", check)
}
}
}