@@ -661,6 +661,26 @@ describe('flows/util', function() {
661661 diffResult . removed . should . have . length ( 0 ) ;
662662 diffResult . rewired . should . have . length ( 0 ) ;
663663 } ) ;
664+
665+
666+ it ( 'marks a deleted tab as removed' , function ( ) {
667+ var config = [ { id :"f1" , type :"tab" , label :"fred" } , { id :"n1" , type :"test" , bar :"b" , wires :[ [ "1" ] ] , z :"f1" } ,
668+ { id :"f2" , type :"tab" , label :"fred" } , { id :"n2" , type :"test" , bar :"b" , wires :[ [ "1" ] ] , z :"f2" } ] ;
669+ var newConfig = clone ( config ) ;
670+ newConfig = newConfig . slice ( 0 , 2 ) ;
671+
672+ var originalConfig = flowUtil . parseConfig ( config ) ;
673+ var changedConfig = flowUtil . parseConfig ( newConfig ) ;
674+
675+ originalConfig . missingTypes . should . have . length ( 0 ) ;
676+
677+ var diffResult = flowUtil . diffConfigs ( originalConfig , changedConfig ) ;
678+ diffResult . added . should . have . length ( 0 ) ;
679+ diffResult . changed . should . have . length ( 0 ) ;
680+ diffResult . removed . sort ( ) . should . eql ( [ 'f2' , 'n2' ] ) ;
681+ diffResult . rewired . should . have . length ( 0 ) ;
682+ } ) ;
683+
664684 it ( 'marks all nodes as added when tab state changes disabled to enabled' , function ( ) {
665685 var config = [ { id :"1" , type :"tab" , disabled :true , label :"fred" } , { id :"2" , type :"test" , bar :"b" , wires :[ [ "1" ] ] , z :"1" } , { id :"3" , type :"test" } ] ;
666686 var newConfig = clone ( config ) ;
0 commit comments