Simplify phone vault screen and settings navigation

This commit is contained in:
Joe Julian
2026-04-02 21:50:36 -07:00
parent 05f56d648e
commit ea7de89c7d
3 changed files with 300 additions and 186 deletions
+36
View File
@@ -24,6 +24,7 @@ import (
"git.julianfamily.org/keepassgo/apiapproval"
"git.julianfamily.org/keepassgo/apiaudit"
"git.julianfamily.org/keepassgo/apitokens"
"git.julianfamily.org/keepassgo/appstate"
"git.julianfamily.org/keepassgo/clipboard"
"git.julianfamily.org/keepassgo/passwords"
"git.julianfamily.org/keepassgo/session"
@@ -806,6 +807,41 @@ func TestUIPhoneListPanelWithExpandedGroupControlsAndEntriesDoesNotPanic(t *test
_ = u.listPanel(gtx)
}
func TestUIPhoneBackReturnsFromSubscreenToEntries(t *testing.T) {
t.Parallel()
u := newUIWithModel("phone", vault.Model{
Entries: []vault.Entry{{ID: "entry-1", Title: "Git Server", Path: []string{"Root", "Internet"}}},
})
u.showAPITokensSection()
if !u.handlePhoneBack() {
t.Fatal("handlePhoneBack() = false, want true for phone subsection")
}
if u.state.Section != appstate.SectionEntries {
t.Fatalf("state.Section = %q, want entries", u.state.Section)
}
}
func TestUISecurityDialogContentDoesNotPanicWithSmallViewport(t *testing.T) {
t.Parallel()
u := newUIWithModel("phone", vault.Model{})
u.securityDialogOpen = true
ops := new(op.Ops)
gtx := layout.Context{
Ops: ops,
Constraints: layout.Exact(image.Pt(540, 420)),
}
defer func() {
if r := recover(); r != nil {
t.Fatalf("securityDialogContent() panicked in small viewport: %v", r)
}
}()
_ = u.securityDialogContent(gtx)
}
func TestUIAPIAuditSectionShowsRecordedEvents(t *testing.T) {
t.Parallel()