Refine entry detail and edit panels
This commit is contained in:
+87
-1
@@ -2187,6 +2187,40 @@ func TestUIAttachmentActionsRejectDuplicateMissingAndOversizeCases(t *testing.T)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUIAttachmentActionSummaryReflectsSelectionState(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
u := newUIWithModel("desktop", vault.Model{
|
||||
Entries: []vault.Entry{
|
||||
{
|
||||
ID: "vault-console",
|
||||
Title: "Vault Console",
|
||||
Attachments: map[string][]byte{"token.txt": []byte("original")},
|
||||
Path: []string{"Root", "Internet"},
|
||||
},
|
||||
},
|
||||
})
|
||||
u.showEntriesSection()
|
||||
u.state.NavigateToPath([]string{"Root", "Internet"})
|
||||
u.filter()
|
||||
u.state.SelectedEntryID = "vault-console"
|
||||
u.loadSelectedEntryIntoEditor()
|
||||
|
||||
if got := u.attachmentActionSummary(); !strings.Contains(got, "Select an attachment above") {
|
||||
t.Fatalf("attachmentActionSummary() = %q, want prompt to select an attachment", got)
|
||||
}
|
||||
|
||||
u.attachmentName.SetText("token.txt")
|
||||
if got := u.attachmentActionSummary(); !strings.Contains(got, "Selected attachment") {
|
||||
t.Fatalf("attachmentActionSummary() = %q, want selected attachment guidance", got)
|
||||
}
|
||||
|
||||
u.attachmentName.SetText("missing.txt")
|
||||
if got := u.attachmentActionSummary(); !strings.Contains(got, "is not on this entry yet") {
|
||||
t.Fatalf("attachmentActionSummary() = %q, want missing attachment guidance", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUIRestoresSelectedEntryHistoryVersion(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -2584,7 +2618,59 @@ func TestUIGeneratedPasswordFlowsIntoCreateEntryForm(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestUIBannerSurfacePrefersLoadingThenError(t *testing.T) {
|
||||
func TestUIGeneratedPasswordDraftStateClearsOnReloadAndSave(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
u := newUIWithModel("desktop", vault.Model{
|
||||
Entries: []vault.Entry{
|
||||
{
|
||||
ID: "vault-console",
|
||||
Title: "Vault Console",
|
||||
Username: "dannyocean",
|
||||
Password: "token-1",
|
||||
Path: []string{"Root", "Internet"},
|
||||
},
|
||||
},
|
||||
})
|
||||
u.showEntriesSection()
|
||||
u.state.NavigateToPath([]string{"Root", "Internet"})
|
||||
u.filter()
|
||||
u.state.SelectedEntryID = "vault-console"
|
||||
u.loadSelectedEntryIntoEditor()
|
||||
|
||||
if u.generatedPasswordDraft {
|
||||
t.Fatal("generatedPasswordDraft = true, want false before generating")
|
||||
}
|
||||
|
||||
u.passwordProfile.SetText("strong")
|
||||
if err := u.generatePasswordAction(); err != nil {
|
||||
t.Fatalf("generatePasswordAction() error = %v", err)
|
||||
}
|
||||
if !u.generatedPasswordDraft {
|
||||
t.Fatal("generatedPasswordDraft = false, want true after generating")
|
||||
}
|
||||
|
||||
u.loadSelectedEntryIntoEditor()
|
||||
if u.generatedPasswordDraft {
|
||||
t.Fatal("generatedPasswordDraft = true, want false after reloading entry into editor")
|
||||
}
|
||||
|
||||
u.passwordProfile.SetText("strong")
|
||||
if err := u.generatePasswordAction(); err != nil {
|
||||
t.Fatalf("generatePasswordAction() second call error = %v", err)
|
||||
}
|
||||
if !u.generatedPasswordDraft {
|
||||
t.Fatal("generatedPasswordDraft = false, want true after generating the second time")
|
||||
}
|
||||
if err := u.saveEntryAction(); err != nil {
|
||||
t.Fatalf("saveEntryAction() error = %v", err)
|
||||
}
|
||||
if u.generatedPasswordDraft {
|
||||
t.Fatal("generatedPasswordDraft = true, want false after saving")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUIBannerSurfacePrefersLoadingThenErrorThenStatus(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
u := newUIWithModel("desktop", vault.Model{})
|
||||
|
||||
Reference in New Issue
Block a user