Fix hidden root section restore
This commit is contained in:
@@ -2198,6 +2198,35 @@ func TestUIAutoEntersSingleVaultRootGroupAndDisplaysSlashRoot(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestUIShowEntriesSectionRestoresHiddenRootAfterLeavingEntries(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
u := newUIWithModel("desktop", vault.Model{
|
||||
Entries: []vault.Entry{
|
||||
{ID: "1", Title: "Vault Console", Path: []string{"keepass", "Crew", "Internet"}},
|
||||
{ID: "2", Title: "Home Assistant", Path: []string{"keepass", "Crew", "Home"}},
|
||||
},
|
||||
})
|
||||
|
||||
u.showEntriesSection()
|
||||
if got := u.currentPath; !slices.Equal(got, []string{"keepass"}) {
|
||||
t.Fatalf("currentPath after initial entries section = %v, want [keepass]", got)
|
||||
}
|
||||
|
||||
u.showAPITokensSection()
|
||||
u.showEntriesSection()
|
||||
|
||||
if got := u.currentPath; !slices.Equal(got, []string{"keepass"}) {
|
||||
t.Fatalf("currentPath after returning to entries = %v, want [keepass]", got)
|
||||
}
|
||||
if got := u.displayPath(); len(got) != 0 {
|
||||
t.Fatalf("displayPath() after returning to entries = %v, want root slash path", got)
|
||||
}
|
||||
if got := u.childGroups(); !slices.Equal(got, []string{"Crew"}) {
|
||||
t.Fatalf("childGroups() after returning to entries = %v, want [Crew]", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUINoteRecentVaultDeduplicatesAndOrdersMostRecentFirst(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user