@@ -815,6 +815,40 @@ describe("WorkflowFormComponent (rendered template)", () => {
815815 expect ( el ( ".result .result-body" ) ) . not . toBeNull ( ) ;
816816 } ) ;
817817
818+ // What the result-update subscription claims: an update for a chart already on the page reaches
819+ // the frame that is there, it does not get the frame rebuilt. A per-result key meant to do that
820+ // used to sit on the frame; this is the assertion that would fail if one came back.
821+ it ( "keeps the same chart frame across that step's result updates" , ( ) => {
822+ const updates = new Subject < Record < string , unknown > > ( ) ;
823+ const wrs : any = TestBed . inject ( WorkflowResultService ) ;
824+ wrs . getResultUpdateStream = ( ) => updates . asObservable ( ) ;
825+ wrs . hasNonEmptyResult = ( ) => true ;
826+ // A snapshot with a picture takes the visualisation branch. The frame's template is blanked
827+ // above, so what is instantiated is the component instance alone, with no iframe to run.
828+ wrs . getResultService = ( ) => ( { getCurrentResultSnapshot : ( ) => [ { "html-content" : "<div>chart</div>" } ] } ) ;
829+ // An update re-reads the shown set from the graph (refreshShownResults), so op-1 has to be a
830+ // step that is on it: with no downstream link it is a final step, shown by default.
831+ const actions : any = TestBed . inject ( WorkflowActionService ) ;
832+ const graph = actions . getTexeraGraph ( ) ;
833+ graph . getAllOperators = ( ) => [ { operatorID : "op-1" } ] ;
834+ actions . getTexeraGraph = ( ) => graph ;
835+ fixture . detectChanges ( ) ;
836+ finishLoad ( ) ;
837+ vi . spyOn ( fixture . componentInstance as any , "fitVisualisations" ) . mockImplementation ( ( ) => { } ) ;
838+
839+ const frame = ( ) => fixture . debugElement . query ( By . directive ( VisualizationFrameContentComponent ) ) ;
840+ const first = frame ( ) ;
841+ expect ( first ) . not . toBeNull ( ) ;
842+
843+ updates . next ( { "op-1" : { } } ) ;
844+ fixture . detectChanges ( ) ;
845+ updates . next ( { "op-1" : { } } ) ;
846+ fixture . detectChanges ( ) ;
847+
848+ expect ( frame ( ) . componentInstance ) . toBe ( first . componentInstance ) ;
849+ expect ( frame ( ) . nativeElement ) . toBe ( first . nativeElement ) ;
850+ } ) ;
851+
818852 it ( "mounts the step panel from the start, hidden until a step is selected" , ( ) => {
819853 fixture . detectChanges ( ) ;
820854 finishLoad ( ) ;
0 commit comments