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:
Sanaei
2026-08-15 21:16:13 +02:00
parent 43bc915397
commit 338822ab07
2 changed files with 28 additions and 4 deletions
+22
View File
@@ -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)