@@ -890,6 +890,40 @@ describe("WorkflowFormComponent (rendered template)", () => {
890890 expect ( names ( ) . map ( e => e . getAttribute ( "aria-current" ) ) ) . toEqual ( [ "false" , "true" ] ) ;
891891 } ) ;
892892
893+ // What the result-update subscription claims: an update for a chart already on the page reaches
894+ // the frame that is there, it does not get the frame rebuilt. A per-result key meant to do that
895+ // used to sit on the frame; this is the assertion that would fail if one came back.
896+ it ( "keeps the same chart frame across that step's result updates" , ( ) => {
897+ const updates = new Subject < Record < string , unknown > > ( ) ;
898+ const wrs : any = TestBed . inject ( WorkflowResultService ) ;
899+ wrs . getResultUpdateStream = ( ) => updates . asObservable ( ) ;
900+ wrs . hasNonEmptyResult = ( ) => true ;
901+ // A snapshot with a picture takes the visualisation branch. The frame's template is blanked
902+ // above, so what is instantiated is the component instance alone, with no iframe to run.
903+ wrs . getResultService = ( ) => ( { getCurrentResultSnapshot : ( ) => [ { "html-content" : "<div>chart</div>" } ] } ) ;
904+ // An update re-reads the shown set from the graph (refreshShownResults), so op-1 has to be a
905+ // step that is on it: with no downstream link it is a final step, shown by default.
906+ const actions : any = TestBed . inject ( WorkflowActionService ) ;
907+ const graph = actions . getTexeraGraph ( ) ;
908+ graph . getAllOperators = ( ) => [ { operatorID : "op-1" } ] ;
909+ actions . getTexeraGraph = ( ) => graph ;
910+ fixture . detectChanges ( ) ;
911+ finishLoad ( ) ;
912+ vi . spyOn ( fixture . componentInstance as any , "fitVisualisations" ) . mockImplementation ( ( ) => { } ) ;
913+
914+ const frame = ( ) => fixture . debugElement . query ( By . directive ( VisualizationFrameContentComponent ) ) ;
915+ const first = frame ( ) ;
916+ expect ( first ) . not . toBeNull ( ) ;
917+
918+ updates . next ( { "op-1" : { } } ) ;
919+ fixture . detectChanges ( ) ;
920+ updates . next ( { "op-1" : { } } ) ;
921+ fixture . detectChanges ( ) ;
922+
923+ expect ( frame ( ) . componentInstance ) . toBe ( first . componentInstance ) ;
924+ expect ( frame ( ) . nativeElement ) . toBe ( first . nativeElement ) ;
925+ } ) ;
926+
893927 it ( "mounts the step panel from the start, hidden until a step is selected" , ( ) => {
894928 fixture . detectChanges ( ) ;
895929 finishLoad ( ) ;
0 commit comments