@@ -106,3 +106,40 @@ describe('authored canvas presentation', () => {
106106 }
107107 } )
108108} )
109+
110+ describe ( 'authored diagram focus' , ( ) => {
111+ it ( 'keeps every node visible when no step is emphasized' , ( ) => {
112+ const { nodes } = toReactFlowElements ( workflow )
113+ expect ( nodes . every ( ( node ) => ! node . data . isDimmed ) ) . toBe ( true )
114+ } )
115+
116+ it ( 'de-emphasizes surrounding cards and containers for a highlighted step' , ( ) => {
117+ const { nodes } = toReactFlowElements ( workflow , false , { highlightBlock : 'agent' } )
118+ expect ( nodes . filter ( ( node ) => node . data . isDimmed ) . map ( ( node ) => node . id ) ) . toEqual ( [
119+ 'start' ,
120+ 'loop' ,
121+ 'parallel' ,
122+ ] )
123+ expect ( nodes . find ( ( node ) => node . id === 'agent' ) ?. data . isHighlighted ) . toBe ( true )
124+ } )
125+
126+ it ( 'keeps both the authored focus and inspected block at full emphasis' , ( ) => {
127+ const { nodes } = toReactFlowElements ( workflow , false , {
128+ highlightBlock : 'agent' ,
129+ selectedBlock : 'loop' ,
130+ } )
131+ expect ( nodes . filter ( ( node ) => ! node . data . isDimmed ) . map ( ( node ) => node . id ) ) . toEqual ( [
132+ 'loop' ,
133+ 'agent' ,
134+ ] )
135+ } )
136+
137+ it ( 'de-emphasizes nodes when the illustration focuses on an edge' , ( ) => {
138+ const { nodes, edges } = toReactFlowElements ( workflow , false , {
139+ highlightEdge : 'loop-agent' ,
140+ } )
141+ expect ( nodes . every ( ( node ) => node . data . isDimmed ) ) . toBe ( true )
142+ expect ( edges . find ( ( edge ) => edge . id === 'loop-agent' ) ?. style ?. opacity ) . toBe ( 1 )
143+ expect ( edges . find ( ( edge ) => edge . id === 'start-loop' ) ?. style ?. opacity ) . toBeLessThan ( 1 )
144+ } )
145+ } )
0 commit comments