Simplify locked vault screen
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user