Snapshot phone entry list during redraw

This commit is contained in:
Joe Julian
2026-04-03 08:28:58 -07:00
parent b4f7ca3002
commit 49e3beee55
2 changed files with 37 additions and 4 deletions
+25
View File
@@ -821,6 +821,31 @@ func TestUIPhoneListPanelWithExpandedGroupControlsAndEntriesDoesNotPanic(t *test
_ = u.listPanel(gtx)
}
func TestUIVisibleEntrySnapshotIsStableAfterVisibleMutation(t *testing.T) {
t.Parallel()
u := newUIWithModel("phone", vault.Model{
Entries: []vault.Entry{
{ID: "1", Title: "Alpha", Path: []string{"Crew", "Internet"}},
{ID: "2", Title: "Beta", Path: []string{"Crew", "Internet"}},
},
})
u.state.NavigateToPath([]string{"Crew", "Internet"})
u.filter()
visible, clicks := u.visibleEntrySnapshot()
if len(visible) != 2 || len(clicks) != 2 {
t.Fatalf("snapshot lengths = (%d, %d), want (2, 2)", len(visible), len(clicks))
}
u.visible = u.visible[:1]
u.entryClicks = u.entryClicks[:1]
if got := visible[1].Title; got != "Beta" {
t.Fatalf("visible snapshot second title = %q, want Beta", got)
}
}
func TestUIPhoneBackReturnsFromSubscreenToEntries(t *testing.T) {
t.Parallel()