Improve entries navigation readability
This commit is contained in:
@@ -3805,6 +3805,86 @@ func TestUITemplateSectionEmptyStateStaysProductSpecific(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestUIListEmptyStateProvidesSectionSpecificGuidance(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
t.Run("empty group", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
u := newUIWithModel("desktop", vault.Model{
|
||||
Entries: []vault.Entry{
|
||||
{ID: "entry-1", Title: "Root Entry", Path: []string{"Root"}},
|
||||
},
|
||||
})
|
||||
u.showEntriesSection()
|
||||
u.setCurrentPath([]string{"Root", "Empty Group"})
|
||||
|
||||
got := u.listEmptyState()
|
||||
want := emptyState{
|
||||
Title: "This group is empty",
|
||||
Body: "Add an entry here, search below this point, or open a subgroup.",
|
||||
}
|
||||
if got != want {
|
||||
t.Fatalf("listEmptyState() = %#v, want %#v", got, want)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("recycle search", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
u := newUIWithModel("desktop", vault.Model{})
|
||||
u.showRecycleBinSection()
|
||||
u.search.SetText("orphaned")
|
||||
|
||||
got := u.listEmptyState()
|
||||
want := emptyState{
|
||||
Title: "No matching deleted entries",
|
||||
Body: `No recycle-bin entries match "orphaned". Clear or refine Search vault to look across deleted titles, usernames, URLs, and paths.`,
|
||||
}
|
||||
if got != want {
|
||||
t.Fatalf("listEmptyState() = %#v, want %#v", got, want)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("api tokens", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
u := newUIWithModel("desktop", vault.Model{})
|
||||
u.showAPITokensSection()
|
||||
|
||||
got := u.listEmptyState()
|
||||
want := emptyState{
|
||||
Title: "No API tokens yet",
|
||||
Body: "Issue a token to grant scoped gRPC access to an external tool.",
|
||||
}
|
||||
if got != want {
|
||||
t.Fatalf("listEmptyState() = %#v, want %#v", got, want)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestUIVisibleBreadcrumbsCompressesAggressivelyOnPhone(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
u := newUIWithModel("phone", vault.Model{})
|
||||
|
||||
gotCrumbs, gotIndices := u.visibleBreadcrumbs([]string{"Root", "Infrastructure"})
|
||||
if !slices.Equal(gotCrumbs, []string{"/", "Infrastructure"}) {
|
||||
t.Fatalf("visibleBreadcrumbs() crumbs = %v, want [\"/\" Infrastructure]", gotCrumbs)
|
||||
}
|
||||
if !slices.Equal(gotIndices, []int{0, 2}) {
|
||||
t.Fatalf("visibleBreadcrumbs() indices = %v, want [0 2]", gotIndices)
|
||||
}
|
||||
|
||||
gotCrumbs, gotIndices = u.visibleBreadcrumbs([]string{"Root", "Infrastructure", "SSH"})
|
||||
if !slices.Equal(gotCrumbs, []string{"/", "…", "SSH"}) {
|
||||
t.Fatalf("visibleBreadcrumbs() deep crumbs = %v, want [\"/\" \"…\" SSH]", gotCrumbs)
|
||||
}
|
||||
if !slices.Equal(gotIndices, []int{0, 2, 3}) {
|
||||
t.Fatalf("visibleBreadcrumbs() deep indices = %v, want [0 2 3]", gotIndices)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUILocalLifecycleActionErrorsAreVisibleAndSpecific(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user