mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
clear workflow state on close
This commit is contained in:
@@ -56,9 +56,10 @@ vi.mock('@/composables/useWorkflowActionsMenu', () => ({
|
||||
})
|
||||
}))
|
||||
|
||||
const mockCloseWorkflow = vi.fn().mockResolvedValue(true)
|
||||
vi.mock('@/platform/workflow/core/services/workflowService', () => ({
|
||||
useWorkflowService: () => ({
|
||||
closeWorkflow: vi.fn()
|
||||
closeWorkflow: mockCloseWorkflow
|
||||
})
|
||||
}))
|
||||
|
||||
@@ -120,7 +121,10 @@ function mountTab({
|
||||
i18n
|
||||
],
|
||||
stubs: {
|
||||
WorkflowActionsList: true
|
||||
WorkflowActionsList: true,
|
||||
Button: {
|
||||
template: '<button v-bind="$attrs"><slot /></button>'
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
@@ -205,4 +209,16 @@ describe('WorkflowTab - job state indicator', () => {
|
||||
'/workflows/test.json'
|
||||
)
|
||||
})
|
||||
|
||||
it('clears workflow status when close succeeds', async () => {
|
||||
mockCloseWorkflow.mockResolvedValue(true)
|
||||
|
||||
const wrapper = mountTab()
|
||||
await wrapper.find('button[aria-label="Close"]').trigger('click')
|
||||
|
||||
expect(mockCloseWorkflow).toHaveBeenCalled()
|
||||
expect(mockExecutionStore.clearWorkflowStatus).toHaveBeenCalledWith(
|
||||
'/workflows/test.json'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -233,6 +233,8 @@ const closeWorkflows = async (options: WorkflowOption[]) => {
|
||||
// User clicked cancel
|
||||
break
|
||||
}
|
||||
const path = opt.workflow.path
|
||||
if (path) executionStore.clearWorkflowStatus(path)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user