Tighten banner and navigation behavior

This commit is contained in:
Joe Julian
2026-03-29 21:16:38 -07:00
parent da769a9728
commit e5904dd224
4 changed files with 87 additions and 7 deletions
+29
View File
@@ -1737,6 +1737,9 @@ func TestUIStatusBannerExpiresAfterTimeout(t *testing.T) {
u := newUIWithModel("desktop", vault.Model{})
u.now = func() time.Time { return now }
u.state.StatusMessage = "synchronize vault complete"
if statusBannerDuration != 2600*time.Millisecond {
t.Fatalf("statusBannerDuration = %v, want 2.6s", statusBannerDuration)
}
u.statusExpiresAt = now.Add(statusBannerDuration)
if got := u.bannerSurface(); got.Kind != bannerStatus || got.Message != "synchronize vault complete" {
@@ -2003,6 +2006,26 @@ func TestUIRecentRemoteConnectionsPersistAndReload(t *testing.T) {
}
}
func TestUIGroupToolsDisclosureStatePersists(t *testing.T) {
t.Parallel()
configPath := filepath.Join(t.TempDir(), "ui-prefs.json")
first := newUIWithSession("desktop", &session.Manager{})
first.uiPreferencesPath = configPath
first.groupControlsHidden = true
first.saveUIPreferences()
second := newUIWithSession("desktop", &session.Manager{})
second.uiPreferencesPath = configPath
second.groupControlsHidden = false
second.loadUIPreferences()
if !second.groupControlsHidden {
t.Fatal("groupControlsHidden = false after reload, want true")
}
}
func TestSelectingRecentRemoteConnectionKeepsPasswordMasked(t *testing.T) {
t.Parallel()
@@ -2107,6 +2130,9 @@ func TestDefaultStatePathsUsesProvidedStateDir(t *testing.T) {
if got := paths.RecentRemotesPath; got != filepath.Join(base, "recent-remotes.json") {
t.Fatalf("RecentRemotesPath = %q, want %q", got, filepath.Join(base, "recent-remotes.json"))
}
if got := paths.UIPreferencesPath; got != filepath.Join(base, "ui-prefs.json") {
t.Fatalf("UIPreferencesPath = %q, want %q", got, filepath.Join(base, "ui-prefs.json"))
}
}
func TestDefaultStatePathsUsesEnvironmentStateDirWhenFlagUnset(t *testing.T) {
@@ -2124,6 +2150,9 @@ func TestDefaultStatePathsUsesEnvironmentStateDirWhenFlagUnset(t *testing.T) {
if got := paths.RecentRemotesPath; got != filepath.Join(base, "recent-remotes.json") {
t.Fatalf("RecentRemotesPath = %q, want %q", got, filepath.Join(base, "recent-remotes.json"))
}
if got := paths.UIPreferencesPath; got != filepath.Join(base, "ui-prefs.json") {
t.Fatalf("UIPreferencesPath = %q, want %q", got, filepath.Join(base, "ui-prefs.json"))
}
}
func TestResolveFlagOrEnvPrefersFlagThenEnvThenFallback(t *testing.T) {