Fenrir's emoji ported to cthulhu.
This commit is contained in:
1 parent
3e2429b8a5
commit
01f50c17e8
24 files changed
+1505
-9
No files matched your search
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2026 Storm Dragon
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
package interaction
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestGridRowsBoundsAndDisabledItems(t *testing.T) {
|
||||
items := []Item{{ID: "1", Label: "One"}, {ID: "2", Label: "Two"}, {ID: "3", Label: "Three"}, {ID: "4", Label: "Four"}, {ID: "5", Label: "Five", Disabled: true}, {ID: "6", Label: "Six"}}
|
||||
session, err := NewGridSession("Picker", []GridTab{{ID: "all", Label: "All", Items: items}}, 3, Element{ID: "copy", Label: "Copy", Kind: CheckBox})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
session.Handle(Event{Key: Tab})
|
||||
for _, step := range []struct {
|
||||
key Key
|
||||
want string
|
||||
}{{Right, "2"}, {Right, "3"}, {Down, "6"}, {Down, "6"}, {Up, "2"}, {Home, "1"}, {Left, "1"}, {End, "6"}, {Right, "6"}, {PageUp, "1"}, {PageDown, "6"}} {
|
||||
session.Handle(Event{Key: step.key})
|
||||
if got := session.Values()["grid"].Selected; got != step.want {
|
||||
t.Fatalf("%v selected %q want %q", step.key, got, step.want)
|
||||
}
|
||||
}
|
||||
if result := session.Handle(Event{Key: Escape}); !result.Cancelled {
|
||||
t.Fatal("escape not cancelled")
|
||||
}
|
||||
if session.Handle(Event{Key: Enter}).Activated != "" || session.Presentation().Speech != "" {
|
||||
t.Fatal("closed grid responded")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user