Limit group view to direct entries

This commit is contained in:
Joe Julian
2026-04-03 08:51:19 -07:00
parent da53696435
commit 198732239a
4 changed files with 27 additions and 37 deletions
+11 -7
View File
@@ -844,6 +844,9 @@ func TestUIVisibleEntrySnapshotIsStableAfterVisibleMutation(t *testing.T) {
if got := visible[1].Title; got != "Beta" {
t.Fatalf("visible snapshot second title = %q, want Beta", got)
}
if clicks[1] == nil {
t.Fatal("snapshot click pointer = nil, want stable clickable pointer")
}
}
func TestUIPhoneBackReturnsFromSubscreenToEntries(t *testing.T) {
@@ -1561,8 +1564,8 @@ func TestUIStartOpenRemoteActionAppliesResultOnMainThread(t *testing.T) {
if !manager.HasVault() {
t.Fatal("manager.HasVault() = false after remote result applied, want true")
}
if got := u.filteredTitles(); !slices.Equal(got, []string{"Git Server"}) {
t.Fatalf("filteredTitles() = %v, want [Git Server]", got)
if got := u.filteredTitles(); len(got) != 0 {
t.Fatalf("filteredTitles() = %v, want empty at root when entries only appear in child groups", got)
}
}
@@ -1757,8 +1760,8 @@ func TestUIStartOpenVaultActionAppliesResultOnMainThread(t *testing.T) {
if !manager.HasVault() {
t.Fatal("manager.HasVault() = false after background result applied, want true")
}
if got := u.filteredTitles(); !slices.Equal(got, []string{"Git Server"}) {
t.Fatalf("filteredTitles() = %v, want [Git Server]", got)
if got := u.filteredTitles(); len(got) != 0 {
t.Fatalf("filteredTitles() = %v, want empty at root when entries only appear in child groups", got)
}
}
@@ -2043,11 +2046,12 @@ func TestUIGroupNavigationLabelsDistinguishRootCurrentAndParent(t *testing.T) {
}
}
func TestUIParentGroupShowsDescendantEntries(t *testing.T) {
func TestUIParentGroupDoesNotShowDescendantEntries(t *testing.T) {
t.Parallel()
u := newUIWithModel("desktop", vault.Model{
Entries: []vault.Entry{
{ID: "joe-note", Title: "Joe Note", Path: []string{"Joe"}},
{ID: "dynadot", Title: "Dynadot", Path: []string{"Joe", "Internet"}},
{ID: "git-server", Title: "Git Server", Path: []string{"Joe", "Internet"}},
{ID: "ha-codex", Title: "Home Assistant (Codex)", Path: []string{"Joe", "Home Assistant"}},
@@ -2057,8 +2061,8 @@ func TestUIParentGroupShowsDescendantEntries(t *testing.T) {
u.state.NavigateToPath([]string{"Joe"})
u.filter()
if got := u.filteredTitles(); !slices.Equal(got, []string{"Dynadot", "Git Server", "Home Assistant (Codex)"}) {
t.Fatalf("filteredTitles() = %v, want descendant entries under Joe", got)
if got := u.filteredTitles(); !slices.Equal(got, []string{"Joe Note"}) {
t.Fatalf("filteredTitles() = %v, want only direct entries under Joe", got)
}
}