mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-16 16:20:59 +00:00
fix(sub): keep copy page within mobile viewport
Constrain the copy-only subscription page to the dynamic viewport, wrap long localized text, and infer text direction so mobile browsers cannot render a horizontally shifted desktop-width page. Add regression coverage for the responsive layout contract.
This commit is contained in:
@@ -105,6 +105,28 @@ func TestSubscriptionCopyPageUsesRequestLocale(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSubscriptionCopyPageIsMobileSafe(t *testing.T) {
|
||||
w := httptest.NewRecorder()
|
||||
c, _ := gin.CreateTestContext(w)
|
||||
c.Request = httptest.NewRequest(http.MethodGet, "/sub/abc", nil)
|
||||
|
||||
(&SUBController{}).serveSubscriptionCopyPage(c)
|
||||
body := w.Body.String()
|
||||
for _, required := range []string{
|
||||
`<meta name="viewport" content="width=device-width, initial-scale=1">`,
|
||||
`* { box-sizing: border-box; }`,
|
||||
`min-height: 100dvh`,
|
||||
`overflow-x: hidden`,
|
||||
`overflow-wrap: anywhere`,
|
||||
`@media (max-width: 480px)`,
|
||||
`<main dir="auto">`,
|
||||
} {
|
||||
if !strings.Contains(body, required) {
|
||||
t.Fatalf("copy page is missing mobile layout constraint %q", required)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestExplicitSubPageRequest(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user