fix(support-chat): simplify legacy mobile styles

This commit is contained in:
t
2026-08-30 19:29:53 +08:00
parent 46144ef63a
commit a27c44ee60
2 changed files with 54 additions and 39 deletions
+23 -8
View File
@@ -165,15 +165,30 @@ func TestSupportChatKeepsOlderMobileWebViewsCompatible(t *testing.T) {
t.Fatalf("read support chat stylesheet: %v", err)
}
css := string(stylesheet)
for _, fallback := range []string{
`background: linear-gradient(145deg, #3c80fb, #4c66ea);`,
`background: linear-gradient(135deg, #397ffb, #5368ed);`,
`background: #eaf2ff;`,
`top: 0; right: 0; bottom: 0; left: 0; inset: 0;`,
`width: 100%; max-width: 360px; width: min(100%, 360px);`,
for _, forbidden := range []string{
`color-mix(`,
`height: 100dvh`,
`inset:`,
`width: min(`,
`top: max(`,
`backdrop-filter`,
`place-items`,
`overflow-wrap: anywhere`,
} {
if !strings.Contains(css, fallback) {
t.Fatalf("support chat stylesheet does not contain older mobile fallback %q", fallback)
if strings.Contains(css, forbidden) {
t.Fatalf("support chat stylesheet must not require newer mobile CSS %q", forbidden)
}
}
for _, marker := range []string{
`.message-row.mine .message-bubble { border-color: #2475fc;`,
`.send-button { width: 40px; height: 40px;`,
`color: #fff; background: #2475fc;`,
`background: #eaf2ff;`,
`top: 0; right: 0; bottom: 0; left: 0;`,
`width: 100%; max-width: 360px;`,
} {
if !strings.Contains(css, marker) {
t.Fatalf("support chat stylesheet does not contain basic mobile CSS %q", marker)
}
}
}