io/input,widget: [API] replace per-widget Focused with Source.Focused

Widgets have themselves as tags, by convention, and so it's possible to
replace the per-widget Focused methods with a general-purpose Source.
Focused query.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2023-11-28 10:35:51 -06:00
parent c3f2abebca
commit e59f91dfd0
9 changed files with 65 additions and 68 deletions
+2 -2
View File
@@ -318,8 +318,8 @@ func TestKeyRouting(t *testing.T) {
func assertFocus(t *testing.T, router *Router, expected event.Tag) {
t.Helper()
if got := router.state().focus; got != expected {
t.Errorf("expected %v to be focused, got %v", expected, got)
if !router.Source().Focused(expected) {
t.Errorf("expected %v to be focused", expected)
}
}