@@ -201,6 +201,35 @@ suite('Blocks', function () {
201201
202202 assertUnpluggedHealFailed ( blocks ) ;
203203 } ) ;
204+ test ( 'Disconnect top of stack with immovable sibling' , function ( ) {
205+ this . blocks . B . setMovable ( false ) ;
206+ this . blocks . A . unplug ( true ) ;
207+ assert . equal ( this . blocks . A . nextConnection . targetBlock ( ) , this . blocks . B ) ;
208+ assert . isNull ( this . blocks . B . nextConnection . targetBlock ( ) ) ;
209+ assert . isNull ( this . blocks . C . previousConnection . targetBlock ( ) ) ;
210+ } ) ;
211+ test ( 'Heal with immovable sibling mid-stack' , function ( ) {
212+ const blockD = this . workspace . newBlock ( 'stack_block' , 'd' ) ;
213+ this . blocks . C . nextConnection . connect ( blockD . previousConnection ) ;
214+ this . blocks . C . setMovable ( false ) ;
215+ this . blocks . B . unplug ( true ) ;
216+ assert . equal ( this . blocks . A . nextConnection . targetBlock ( ) , blockD ) ;
217+ assert . equal ( this . blocks . B . nextConnection . targetBlock ( ) , this . blocks . C ) ;
218+ assert . isNull ( this . blocks . C . nextConnection . targetBlock ( ) ) ;
219+ } ) ;
220+ test ( 'Heal with immovable sibling and shadow sibling mid-stack' , function ( ) {
221+ const blockD = this . workspace . newBlock ( 'stack_block' , 'd' ) ;
222+ const blockE = this . workspace . newBlock ( 'stack_block' , 'e' ) ;
223+ this . blocks . C . nextConnection . connect ( blockD . previousConnection ) ;
224+ blockD . nextConnection . connect ( blockE . previousConnection ) ;
225+ this . blocks . C . setMovable ( false ) ;
226+ blockD . setShadow ( true ) ;
227+ this . blocks . B . unplug ( true ) ;
228+ assert . equal ( this . blocks . A . nextConnection . targetBlock ( ) , blockE ) ;
229+ assert . equal ( this . blocks . B . nextConnection . targetBlock ( ) , this . blocks . C ) ;
230+ assert . equal ( this . blocks . C . nextConnection . targetBlock ( ) , blockD ) ;
231+ assert . isNull ( blockD . nextConnection . targetBlock ( ) ) ;
232+ } ) ;
204233 test ( 'Child is shadow' , function ( ) {
205234 const blocks = this . blocks ;
206235 blocks . C . setShadow ( true ) ;
0 commit comments