@@ -557,7 +557,8 @@ describe('hasWorkflowChanged', () => {
557557 } )
558558
559559 describe ( 'InputFormat SubBlock Special Handling' , ( ) => {
560- it . concurrent ( 'should ignore value and collapsed fields in inputFormat' , ( ) => {
560+ it . concurrent ( 'should ignore collapsed field but detect value changes in inputFormat' , ( ) => {
561+ // Only collapsed changes - should NOT detect as change
561562 const state1 = createWorkflowState ( {
562563 blocks : {
563564 block1 : createBlock ( 'block1' , {
@@ -578,8 +579,8 @@ describe('hasWorkflowChanged', () => {
578579 subBlocks : {
579580 inputFormat : {
580581 value : [
581- { id : 'input1' , name : 'Name' , value : 'Jane ' , collapsed : false } ,
582- { id : 'input2' , name : 'Age' , value : 30 , collapsed : true } ,
582+ { id : 'input1' , name : 'Name' , value : 'John ' , collapsed : false } ,
583+ { id : 'input2' , name : 'Age' , value : 25 , collapsed : true } ,
583584 ] ,
584585 } ,
585586 } ,
@@ -589,6 +590,32 @@ describe('hasWorkflowChanged', () => {
589590 expect ( hasWorkflowChanged ( state1 , state2 ) ) . toBe ( false )
590591 } )
591592
593+ it . concurrent ( 'should detect value changes in inputFormat' , ( ) => {
594+ const state1 = createWorkflowState ( {
595+ blocks : {
596+ block1 : createBlock ( 'block1' , {
597+ subBlocks : {
598+ inputFormat : {
599+ value : [ { id : 'input1' , name : 'Name' , value : 'John' } ] ,
600+ } ,
601+ } ,
602+ } ) ,
603+ } ,
604+ } )
605+ const state2 = createWorkflowState ( {
606+ blocks : {
607+ block1 : createBlock ( 'block1' , {
608+ subBlocks : {
609+ inputFormat : {
610+ value : [ { id : 'input1' , name : 'Name' , value : 'Jane' } ] ,
611+ } ,
612+ } ,
613+ } ) ,
614+ } ,
615+ } )
616+ expect ( hasWorkflowChanged ( state1 , state2 ) ) . toBe ( true )
617+ } )
618+
592619 it . concurrent ( 'should detect actual inputFormat changes' , ( ) => {
593620 const state1 = createWorkflowState ( {
594621 blocks : {
@@ -1712,15 +1739,15 @@ describe('hasWorkflowChanged', () => {
17121739 } )
17131740
17141741 describe ( 'Input Format Field Scenarios' , ( ) => {
1715- it . concurrent ( 'should not detect change when inputFormat value is typed and cleared ' , ( ) => {
1716- // The "value " field in inputFormat is UI-only and should be ignored
1742+ it . concurrent ( 'should not detect change when only inputFormat collapsed changes ' , ( ) => {
1743+ // The "collapsed " field in inputFormat is UI-only and should be ignored
17171744 const deployedState = createWorkflowState ( {
17181745 blocks : {
17191746 block1 : createBlock ( 'block1' , {
17201747 subBlocks : {
17211748 inputFormat : {
17221749 value : [
1723- { id : 'field1' , name : 'Name' , type : 'string' , value : '' , collapsed : false } ,
1750+ { id : 'field1' , name : 'Name' , type : 'string' , value : 'test ' , collapsed : false } ,
17241751 ] ,
17251752 } ,
17261753 } ,
@@ -1738,7 +1765,7 @@ describe('hasWorkflowChanged', () => {
17381765 id : 'field1' ,
17391766 name : 'Name' ,
17401767 type : 'string' ,
1741- value : 'typed then cleared ' ,
1768+ value : 'test ' ,
17421769 collapsed : true ,
17431770 } ,
17441771 ] ,
@@ -1748,10 +1775,40 @@ describe('hasWorkflowChanged', () => {
17481775 } ,
17491776 } )
17501777
1751- // value and collapsed are UI-only fields - should NOT detect as change
1778+ // collapsed is UI-only field - should NOT detect as change
17521779 expect ( hasWorkflowChanged ( currentState , deployedState ) ) . toBe ( false )
17531780 } )
17541781
1782+ it . concurrent ( 'should detect change when inputFormat value changes' , ( ) => {
1783+ // The "value" field in inputFormat is meaningful and should trigger change detection
1784+ const deployedState = createWorkflowState ( {
1785+ blocks : {
1786+ block1 : createBlock ( 'block1' , {
1787+ subBlocks : {
1788+ inputFormat : {
1789+ value : [ { id : 'field1' , name : 'Name' , type : 'string' , value : '' } ] ,
1790+ } ,
1791+ } ,
1792+ } ) ,
1793+ } ,
1794+ } )
1795+
1796+ const currentState = createWorkflowState ( {
1797+ blocks : {
1798+ block1 : createBlock ( 'block1' , {
1799+ subBlocks : {
1800+ inputFormat : {
1801+ value : [ { id : 'field1' , name : 'Name' , type : 'string' , value : 'new value' } ] ,
1802+ } ,
1803+ } ,
1804+ } ) ,
1805+ } ,
1806+ } )
1807+
1808+ // value changes should be detected
1809+ expect ( hasWorkflowChanged ( currentState , deployedState ) ) . toBe ( true )
1810+ } )
1811+
17551812 it . concurrent ( 'should detect change when inputFormat field name changes' , ( ) => {
17561813 const deployedState = createWorkflowState ( {
17571814 blocks : {
0 commit comments