summaryrefslogtreecommitdiff
path: root/internal/tui/common/keys_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-09 23:01:38 +0200
committerPaul Buetow <paul@buetow.org>2026-03-09 23:01:38 +0200
commit227de0db390fec4e1327a7cab6be4c1268848695 (patch)
treef70ff9f3b23db47db0e0aeafa1bb1aad5abc71a8 /internal/tui/common/keys_test.go
parentbcaa22111ac619e317f7adfd60a1fc6bd4db8d29 (diff)
tui: add reverse sorting for dashboard tables (task 364)
Diffstat (limited to 'internal/tui/common/keys_test.go')
-rw-r--r--internal/tui/common/keys_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/tui/common/keys_test.go b/internal/tui/common/keys_test.go
index 8d34285..2c48603 100644
--- a/internal/tui/common/keys_test.go
+++ b/internal/tui/common/keys_test.go
@@ -43,6 +43,10 @@ func TestDefaultKeyMapIncludesDirGroupBinding(t *testing.T) {
if sortHelp.Key != "s" || sortHelp.Desc != "sort table" {
t.Fatalf("unexpected sort binding help: key=%q desc=%q", sortHelp.Key, sortHelp.Desc)
}
+ reverseSortHelp := keys.ReverseSort.Help()
+ if reverseSortHelp.Key != "S" || reverseSortHelp.Desc != "reverse sort" {
+ t.Fatalf("unexpected reverse sort binding help: key=%q desc=%q", reverseSortHelp.Key, reverseSortHelp.Desc)
+ }
undoHelp := keys.FilterUndo.Help()
if undoHelp.Key != "F" || undoHelp.Desc != "undo filter" {
@@ -156,6 +160,18 @@ func TestDashboardFullHelpIncludesDirGroupBinding(t *testing.T) {
found = false
for _, binding := range groups[1] {
help := binding.Help()
+ if help.Key == "S" && help.Desc == "reverse sort" {
+ found = true
+ break
+ }
+ }
+ if !found {
+ t.Fatalf("expected reverse sort binding in dashboard full help controls")
+ }
+
+ found = false
+ for _, binding := range groups[1] {
+ help := binding.Help()
if help.Key == "F" && help.Desc == "undo filter" {
found = true
break
@@ -174,6 +190,7 @@ func TestDashboardStatusHelpIncludesProbesBinding(t *testing.T) {
foundOne := false
foundUndo := false
foundSort := false
+ foundReverseSort := false
for _, binding := range short {
help := binding.Help()
if help.Key == "o" && help.Desc == "probes" {
@@ -191,6 +208,9 @@ func TestDashboardStatusHelpIncludesProbesBinding(t *testing.T) {
if help.Key == "s" && help.Desc == "sort table" {
foundSort = true
}
+ if help.Key == "S" && help.Desc == "reverse sort" {
+ foundReverseSort = true
+ }
}
if !found {
t.Fatalf("expected probes binding in dashboard short help")
@@ -207,4 +227,7 @@ func TestDashboardStatusHelpIncludesProbesBinding(t *testing.T) {
if !foundSort {
t.Fatalf("expected sort binding in dashboard short help")
}
+ if !foundReverseSort {
+ t.Fatalf("expected reverse sort binding in dashboard short help")
+ }
}