mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-07 05:34:17 +00:00
28 lines
612 B
Go
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)
|
|
}
|
|
}
|
|
}
|