Simplify locked vault screen

This commit is contained in:
Joe Julian
2026-03-29 16:47:29 -07:00
parent 2e9e2aae5f
commit 4b78a649b1
4 changed files with 112 additions and 3 deletions
+46
View File
@@ -2049,6 +2049,52 @@ func TestEnterOnRemoteLifecycleScreenDefaultsToOpenRemoteVault(t *testing.T) {
}
}
func TestEnterOnLockedScreenDefaultsToUnlockVault(t *testing.T) {
t.Parallel()
u := newUIWithSession("desktop", &session.Manager{})
u.masterPassword.SetText("correct horse battery staple")
if err := u.createVaultAction(); err != nil {
t.Fatalf("createVaultAction() error = %v", err)
}
if err := u.lockAction(); err != nil {
t.Fatalf("lockAction() error = %v", err)
}
u.masterPassword.SetText("correct horse battery staple")
handled := u.handleKeyPress(key.NameReturn, 0)
if !handled {
t.Fatal("handleKeyPress(Return) = false, want true while locked")
}
if u.isVaultLocked() {
t.Fatal("isVaultLocked() = true, want false after unlock")
}
if got := u.masterPassword.Text(); got != "" {
t.Fatalf("masterPassword after unlock = %q, want empty", got)
}
}
func TestUILockedVaultUsesSingleUnlockPaneAndOmitsSearchFocus(t *testing.T) {
t.Parallel()
u := newUIWithSession("desktop", &session.Manager{})
u.masterPassword.SetText("correct horse battery staple")
if err := u.createVaultAction(); err != nil {
t.Fatalf("createVaultAction() error = %v", err)
}
if err := u.lockAction(); err != nil {
t.Fatalf("lockAction() error = %v", err)
}
if !u.shouldUseLockedSinglePane() {
t.Fatal("shouldUseLockedSinglePane() = false, want true while locked")
}
if got := u.focusOrder(); !slices.Equal(got, []focusID{detailFocusID(detailFieldPassword)}) {
t.Fatalf("focusOrder() while locked = %v, want only unlock password focus", got)
}
}
func TestUICopyActionsWriteExpectedClipboardContentsAndSanitizedFeedback(t *testing.T) {
t.Parallel()