Snapshot phone entry list during redraw
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user