@@ -369,15 +369,26 @@ suite('Navigation', function () {
369369 this . blocks . secondBlock = secondBlock ;
370370 this . blocks . outputNextBlock = outputNextBlock ;
371371
372- const buttonBlock = this . workspace . newBlock ( 'buttons' ) ;
373- const buttonInput1 = this . workspace . newBlock ( 'field_input' ) ;
374- const buttonInput2 = this . workspace . newBlock ( 'field_input' ) ;
372+ const buttonBlock = this . workspace . newBlock ( 'buttons' , 'button_block' ) ;
373+ const buttonInput1 = this . workspace . newBlock (
374+ 'field_input' ,
375+ 'button_input1' ,
376+ ) ;
377+ const buttonInput2 = this . workspace . newBlock (
378+ 'field_input' ,
379+ 'button_input2' ,
380+ ) ;
381+ const buttonNext = this . workspace . newBlock (
382+ 'input_statement' ,
383+ 'button_next' ,
384+ ) ;
375385 buttonBlock . inputList [ 0 ] . connection . connect (
376386 buttonInput1 . outputConnection ,
377387 ) ;
378388 buttonBlock . inputList [ 2 ] . connection . connect (
379389 buttonInput2 . outputConnection ,
380390 ) ;
391+ buttonBlock . nextConnection . connect ( buttonNext . previousConnection ) ;
381392 // Make buttons by adding a click handler
382393 const clickHandler = function ( ) {
383394 return ;
@@ -388,6 +399,7 @@ suite('Navigation', function () {
388399 this . blocks . buttonBlock = buttonBlock ;
389400 this . blocks . buttonInput1 = buttonInput1 ;
390401 this . blocks . buttonInput2 = buttonInput2 ;
402+ this . blocks . buttonNext = buttonNext ;
391403
392404 this . workspace . cleanUp ( ) ;
393405 } ) ;
@@ -505,17 +517,22 @@ suite('Navigation', function () {
505517 } ) ;
506518 test ( 'fromBlockToFieldInNextInput' , function ( ) {
507519 const field = this . blocks . buttonBlock . getField ( 'BUTTON2' ) ;
508- const prevNode = this . navigator . getNextSibling (
520+ const nextNode = this . navigator . getNextSibling (
509521 this . blocks . buttonInput1 ,
510522 ) ;
511- assert . equal ( prevNode , field ) ;
523+ assert . equal ( nextNode , field ) ;
512524 } ) ;
513525 test ( 'fromBlockToFieldSkippingInput' , function ( ) {
514526 const field = this . blocks . buttonBlock . getField ( 'BUTTON3' ) ;
515- const prevNode = this . navigator . getNextSibling (
527+ const nextNode = this . navigator . getNextSibling (
516528 this . blocks . buttonInput2 ,
517529 ) ;
518- assert . equal ( prevNode , field ) ;
530+ assert . equal ( nextNode , field ) ;
531+ } ) ;
532+ test ( 'skipsChildrenOfCollapsedBlocks' , function ( ) {
533+ this . blocks . buttonBlock . setCollapsed ( true ) ;
534+ const nextNode = this . navigator . getNextSibling ( this . blocks . buttonBlock ) ;
535+ assert . equal ( nextNode . id , this . blocks . buttonNext . id ) ;
519536 } ) ;
520537 } ) ;
521538
@@ -645,6 +662,13 @@ suite('Navigation', function () {
645662 ) ;
646663 assert . equal ( prevNode , field ) ;
647664 } ) ;
665+ test ( 'skipsChildrenOfCollapsedBlocks' , function ( ) {
666+ this . blocks . buttonBlock . setCollapsed ( true ) ;
667+ const prevNode = this . navigator . getPreviousSibling (
668+ this . blocks . buttonNext ,
669+ ) ;
670+ assert . equal ( prevNode . id , this . blocks . buttonBlock . id ) ;
671+ } ) ;
648672 } ) ;
649673
650674 suite ( 'In' , function ( ) {
@@ -725,6 +749,11 @@ suite('Navigation', function () {
725749 const inNode = this . navigator . getFirstChild ( icons [ 0 ] ) ;
726750 assert . isNull ( inNode ) ;
727751 } ) ;
752+ test ( 'skipsChildrenOfCollapsedBlocks' , function ( ) {
753+ this . blocks . buttonBlock . setCollapsed ( true ) ;
754+ const inNode = this . navigator . getFirstChild ( this . blocks . buttonBlock ) ;
755+ assert . isNull ( inNode ) ;
756+ } ) ;
728757 } ) ;
729758
730759 suite ( 'Out' , function ( ) {
0 commit comments