@@ -235,6 +235,73 @@ suite('Statement move tests', function () {
235235 } ) ,
236236 ) ;
237237
238+ /** ID of a statement block with no inputs. */
239+ const BLOCK_COMPLEX = 'complex_mover' ;
240+
241+ /**
242+ * Expected connection candidates when moving BLOCK_COMPLEX, after
243+ * pressing right or down arrow n times.
244+ */
245+ const EXPECTED_COMPLEX = [
246+ // TODO(#702): Due to a bug in KeyboardDragStrategy, certain
247+ // connection candidates that can be found using the mouse are not
248+ // visited when doing a keyboard drag. They appear in the list
249+ // below, but commented out for now.
250+ // is fixed.
251+ { id : 'simple_mover' , index : 1 , ownIndex : 0 } , // Next; starting location.
252+ // {id: 'text_print', index: 0, ownIndex: 1}, // Previous to own next.
253+ { id : 'text_print' , index : 0 , ownIndex : 4 } , // Previous to own else input.
254+ // {id: 'text_print', index: 0, ownIndex: 3}, // Previous to own if input.
255+ { id : 'text_print' , index : 1 , ownIndex : 0 } , // Next.
256+ { id : 'controls_if' , index : 3 , ownIndex : 0 } , // "If" statement input.
257+ { id : 'controls_repeat_ext' , index : 3 , ownIndex : 0 } , // Statement input.
258+ { id : 'controls_repeat_ext' , index : 1 , ownIndex : 0 } , // Next.
259+ { id : 'controls_if' , index : 5 , ownIndex : 0 } , // "Else if" statement input.
260+ { id : 'controls_if' , index : 6 , ownIndex : 0 } , // "Else" statement input.
261+ { id : 'controls_if' , index : 1 , ownIndex : 0 } , // Next.
262+ { id : 'p5_draw' , index : 0 , ownIndex : 0 } , // Statement input.
263+ { id : 'p5_canvas' , index : 1 , ownIndex : 0 } , // Next; starting location again.
264+ { id : 'simple_mover' , index : 1 , ownIndex : 0 } , // Next; starting location.
265+ ] ;
266+ const EXPECTED_COMPLEX_REVERSED = EXPECTED_COMPLEX . slice ( ) . reverse ( ) ;
267+
268+ test (
269+ 'Constrained move of complex stack block right' ,
270+ moveTest ( BLOCK_COMPLEX , Key . ArrowRight , EXPECTED_COMPLEX , {
271+ parentId : null ,
272+ parentIndex : null ,
273+ nextId : null , // TODO(#702): Should be 'text_print',
274+ valueId : null ,
275+ } ) ,
276+ ) ;
277+ test (
278+ 'Constrained move of complex stack block left' ,
279+ moveTest ( BLOCK_COMPLEX , Key . ArrowLeft , EXPECTED_COMPLEX_REVERSED , {
280+ parentId : 'p5_canvas' ,
281+ parentIndex : 1 ,
282+ nextId : 'simple_mover' ,
283+ valueId : null ,
284+ } ) ,
285+ ) ;
286+ test (
287+ 'Constrained move of complex stack block down' ,
288+ moveTest ( BLOCK_COMPLEX , Key . ArrowDown , EXPECTED_COMPLEX , {
289+ parentId : null ,
290+ parentIndex : null ,
291+ nextId : null , // TODO(#702): Should be 'text_print',
292+ valueId : null ,
293+ } ) ,
294+ ) ;
295+ test (
296+ 'Constrained move of complex stack block up' ,
297+ moveTest ( BLOCK_COMPLEX , Key . ArrowUp , EXPECTED_COMPLEX_REVERSED , {
298+ parentId : 'p5_canvas' ,
299+ parentIndex : 1 ,
300+ nextId : 'simple_mover' ,
301+ valueId : null ,
302+ } ) ,
303+ ) ;
304+
238305 // When a top-level block with no previous, next or output
239306 // connections is subject to a constrained move, it should not move.
240307 //
0 commit comments