feat: Аккаунт › Вид - tab icons left, right or hidden, terminal font, compact file lists, the time column, animations; kept per user on the server. Uploads show a ring filling as they go
This commit is contained in:
1 parent
c003b51b4c
commit
5216aed237
10 files changed
+167
-3
No files matched your search
@@ -115,3 +115,29 @@ func TestSettingsShowAI(t *testing.T) {
|
||||
t.Fatal("the AI card is empty")
|
||||
}
|
||||
}
|
||||
|
||||
// The look of the panel is each user's: kept on the server, only known
|
||||
// settings with known values, and given to the page at once.
|
||||
func TestViewPrefs(t *testing.T) {
|
||||
s, c := newTestServer(t)
|
||||
post := func(body string) string {
|
||||
req := httptest.NewRequest(http.MethodPost, "/api/panel/account/prefs", strings.NewReader(body))
|
||||
req.AddCookie(c)
|
||||
w := httptest.NewRecorder()
|
||||
s.Handler().ServeHTTP(w, req)
|
||||
return w.Body.String()
|
||||
}
|
||||
if got := post(`{"tabIcons":"right","termFont":16,"compact":true,"motion":"off","evil":"<x>","fileTime":"maybe"}`); !strings.Contains(got, `"ok":true`) {
|
||||
t.Fatal(got)
|
||||
}
|
||||
got := get(t, s, c, "/api/panel/account/prefs").Body.String()
|
||||
if !strings.Contains(got, `"tabIcons":"right"`) || !strings.Contains(got, `"termFont":16`) || strings.Contains(got, "evil") || strings.Contains(got, "maybe") {
|
||||
t.Fatalf("prefs: %s", got)
|
||||
}
|
||||
if body := get(t, s, c, "/workspace").Body.String(); !strings.Contains(body, `"tabIcons":"right"`) {
|
||||
t.Fatal("the page does not get the prefs")
|
||||
}
|
||||
if got := post(`{"termFont":99}`); !strings.Contains(got, `"ok":true`) || strings.Contains(get(t, s, c, "/api/panel/account/prefs").Body.String(), "99") {
|
||||
t.Fatal("a font size out of range was kept")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user