diff --git a/frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.spec.ts b/frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.spec.ts index 85c9016500f..659af0feb2b 100644 --- a/frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.spec.ts +++ b/frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.spec.ts @@ -310,6 +310,41 @@ describe("WorkflowVersionService", () => { }); }); + // ─── unhighlightOpVersionDiff ───────────────────────────────────────────── + + describe("unhighlightOpVersionDiff", () => { + it("resets the boundary fill of added and modified ops to transparent", () => { + service.unhighlightOpVersionDiff({ modified: ["m"], added: ["a"], deleted: [] }); + + expect(paperGetModelById).toHaveBeenCalledWith("m"); + expect(paperGetModelById).toHaveBeenCalledWith("a"); + expect(modelAttr).toHaveBeenCalledWith("rect.boundary/fill", "rgba(0,0,0,0)"); + }); + + it("resets the red brackets drawn around the neighbors of deleted ops", () => { + const tempWorkflow = buildWorkflow({ + content: buildContent({ + operators: [buildOperator({ operatorID: "alive-left" }), buildOperator({ operatorID: "alive-right" })], + links: [buildLink("dead", "alive-right"), buildLink("alive-left", "dead")], + }), + }); + actionSpy.getTempWorkflow.mockReturnValue(tempWorkflow); + + service.unhighlightOpVersionDiff({ modified: [], added: [], deleted: ["dead"] }); + + expect(modelAttr).toHaveBeenCalledWith("path.left-boundary/stroke", "rgba(0,0,0,0)"); + expect(modelAttr).toHaveBeenCalledWith("path.right-boundary/stroke", "rgba(0,0,0,0)"); + }); + + it("skips bracket clearing when the temp workflow is missing", () => { + actionSpy.getTempWorkflow.mockReturnValue(undefined); + + service.unhighlightOpVersionDiff({ modified: [], added: [], deleted: ["dead"] }); + + expect(getMainJointPaper).not.toHaveBeenCalled(); + }); + }); + // ─── getWorkflowsDifference / getOperatorsDifference ────────────────────── describe("getWorkflowsDifference", () => { diff --git a/frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.ts b/frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.ts index 0c31b4edf11..1b527e35cb9 100644 --- a/frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.ts +++ b/frontend/src/app/dashboard/service/user/workflow-version/workflow-version.service.ts @@ -271,6 +271,20 @@ export class WorkflowVersionService { for (const id of differentOpIDsList.added.concat(differentOpIDsList.modified)) { this.highlightOpBoundary(id, "0,0,0,0"); } + + if (differentOpIDsList.deleted.length > 0) { + const tempWorkflow = this.workflowActionService.getTempWorkflow(); + if (tempWorkflow != undefined) { + for (const link of tempWorkflow.content.links) { + if (differentOpIDsList.deleted.includes(link.source.operatorID) && link.target.operatorID != undefined) { + this.highlightOpBracket(link.target.operatorID, "0,0,0,0", "left-"); + } + if (differentOpIDsList.deleted.includes(link.target.operatorID) && link.source.operatorID != undefined) { + this.highlightOpBracket(link.source.operatorID, "0,0,0,0", "right-"); + } + } + } + } this.operatorPropertyDiff = {}; }