@@ -67,18 +67,25 @@ test("mode-less bindings stay active when opencode mode changes", async () => {
6767 const config = createTuiResolvedConfig ( )
6868 const offKeymap = registerOpencodeKeymap ( keymap , renderer , config )
6969 const offGlobal = keymap . registerLayer ( {
70- commands : [ { name : "session.list" , run ( ) { } } ] ,
71- bindings : config . keybinds . gather ( "test.global" , [ "session.list" ] ) ,
70+ commands : [
71+ { name : "session.list" , run ( ) { } } ,
72+ { name : "session.new" , run ( ) { } } ,
73+ { name : "session.page.up" , run ( ) { } } ,
74+ ] ,
75+ bindings : config . keybinds . gather ( "test.global" , [ "session.list" , "session.new" , "session.page.up" ] ) ,
7276 } )
7377 const offBase = keymap . registerLayer ( {
7478 mode : OPENCODE_BASE_MODE ,
75- commands : [ { name : "session.new " , run ( ) { } } ] ,
76- bindings : config . keybinds . gather ( "test.base" , [ "session.new " ] ) ,
79+ commands : [ { name : "model.list " , run ( ) { } } ] ,
80+ bindings : config . keybinds . gather ( "test.base" , [ "model.list " ] ) ,
7781 } )
7882 const activeCounts = ( ) =>
7983 Object . fromEntries (
8084 Array . from (
81- keymap . getCommandBindings ( { visibility : "active" , commands : [ "session.list" , "session.new" ] } ) ,
85+ keymap . getCommandBindings ( {
86+ visibility : "active" ,
87+ commands : [ "session.list" , "session.new" , "session.page.up" , "model.list" ] ,
88+ } ) ,
8289 ( [ command , bindings ] ) => [ command , bindings . length ] ,
8390 ) ,
8491 )
@@ -107,9 +114,9 @@ test("mode-less bindings stay active when opencode mode changes", async () => {
107114 const app = await testRender ( ( ) => < Harness /> )
108115 try {
109116 expect ( counts ) . toEqual ( {
110- base : { "session.list" : 1 , "session.new" : 1 } ,
111- question : { "session.list" : 1 , "session.new" : 0 } ,
112- autocomplete : { "session.list" : 1 , "session.new" : 0 } ,
117+ base : { "session.list" : 1 , "session.new" : 1 , "session.page.up" : 2 , "model.list" : 1 } ,
118+ question : { "session.list" : 1 , "session.new" : 1 , "session.page.up" : 2 , "model.list" : 0 } ,
119+ autocomplete : { "session.list" : 1 , "session.new" : 1 , "session.page.up" : 2 , "model.list" : 0 } ,
113120 } )
114121 } finally {
115122 app . renderer . destroy ( )
0 commit comments