@@ -56,7 +56,7 @@ test('unsupportedRefSnapshotFlags returns empty when no ref-unsupported flags ar
5656 assert . deepEqual ( unsupported , [ ] ) ;
5757} ) ;
5858
59- test ( 'click coordinates dispatches press and records as click ' , async ( ) => {
59+ test ( 'press coordinates dispatches press and records as press ' , async ( ) => {
6060 const sessionStore = makeSessionStore ( ) ;
6161 const sessionName = 'default' ;
6262 sessionStore . set ( sessionName , makeSession ( sessionName ) ) ;
@@ -67,7 +67,7 @@ test('click coordinates dispatches press and records as click', async () => {
6767 req : {
6868 token : 't' ,
6969 session : sessionName ,
70- command : 'click ' ,
70+ command : 'press ' ,
7171 positionals : [ '100' , '200' ] ,
7272 flags : { count : 3 , intervalMs : 1 , doubleTap : true } ,
7373 } ,
@@ -92,7 +92,7 @@ test('click coordinates dispatches press and records as click', async () => {
9292 const session = sessionStore . get ( sessionName ) ;
9393 assert . ok ( session ) ;
9494 assert . equal ( session ?. actions . length , 1 ) ;
95- assert . equal ( session ?. actions [ 0 ] ?. command , 'click ' ) ;
95+ assert . equal ( session ?. actions [ 0 ] ?. command , 'press ' ) ;
9696 assert . deepEqual ( session ?. actions [ 0 ] ?. positionals , [ '100' , '200' ] ) ;
9797} ) ;
9898
@@ -155,30 +155,33 @@ test('press @ref resolves snapshot node and records press action', async () => {
155155 assert . ok ( Array . isArray ( result . selectorChain ) ) ;
156156} ) ;
157157
158- test ( 'press coordinates returns null to allow daemon passthrough ' , async ( ) => {
158+ test ( 'press coordinates does not treat extra trailing args as selector ' , async ( ) => {
159159 const sessionStore = makeSessionStore ( ) ;
160160 const sessionName = 'default' ;
161161 sessionStore . set ( sessionName , makeSession ( sessionName ) ) ;
162162
163- let dispatchCalls = 0 ;
163+ const dispatchCalls : Array < { command : string ; positionals : string [ ] } > = [ ] ;
164164 const response = await handleInteractionCommands ( {
165165 req : {
166166 token : 't' ,
167167 session : sessionName ,
168168 command : 'press' ,
169- positionals : [ '100' , '200' ] ,
169+ positionals : [ '100' , '200' , 'extra' ] ,
170170 flags : { count : 2 } ,
171171 } ,
172172 sessionName,
173173 sessionStore,
174174 contextFromFlags,
175- dispatch : async ( ) => {
176- dispatchCalls += 1 ;
177- return { } ;
175+ dispatch : async ( _device , command , positionals ) => {
176+ dispatchCalls . push ( { command , positionals } ) ;
177+ return { ok : true } ;
178178 } ,
179179 } ) ;
180180
181- assert . equal ( response , null ) ;
182- assert . equal ( dispatchCalls , 0 ) ;
183- assert . equal ( sessionStore . get ( sessionName ) ?. actions . length , 0 ) ;
181+ assert . ok ( response ) ;
182+ assert . equal ( response . ok , true ) ;
183+ assert . equal ( dispatchCalls . length , 1 ) ;
184+ assert . equal ( dispatchCalls [ 0 ] ?. command , 'press' ) ;
185+ assert . deepEqual ( dispatchCalls [ 0 ] ?. positionals , [ '100' , '200' ] ) ;
186+ assert . equal ( sessionStore . get ( sessionName ) ?. actions . length , 1 ) ;
184187} ) ;
0 commit comments