feat(editor): Add "Change owner" option to editor (#15792)

This commit is contained in:
Raúl Gómez Morales
2025-06-03 09:59:07 +02:00
committed by GitHub
parent e76c45d46d
commit 5bc4e5d846
7 changed files with 116 additions and 53 deletions

View File

@@ -6,7 +6,9 @@ import {
MODAL_CONFIRM,
VIEWS,
WORKFLOW_SHARE_MODAL_KEY,
PROJECT_MOVE_RESOURCE_MODAL,
} from '@/constants';
import type { IWorkflowDb } from '@/Interface';
import { STORES } from '@n8n/stores';
import { createTestingPinia } from '@pinia/testing';
import userEvent from '@testing-library/user-event';
@@ -59,6 +61,11 @@ const initialState = {
enterprise: {
[EnterpriseEditionFeature.Sharing]: true,
[EnterpriseEditionFeature.WorkflowHistory]: true,
projects: {
team: {
limit: -1,
},
},
},
},
areTagsEnabled: true,
@@ -394,6 +401,27 @@ describe('WorkflowDetails', () => {
name: VIEWS.WORKFLOWS,
});
});
it("should call onWorkflowMenuSelect on 'Change owner' option click", async () => {
const openModalSpy = vi.spyOn(uiStore, 'openModalWithData');
workflowsStore.workflowsById = { [workflow.id]: workflow as IWorkflowDb };
const { getByTestId } = renderComponent({
props: {
...workflow,
scopes: ['workflow:move'],
},
});
await userEvent.click(getByTestId('workflow-menu'));
await userEvent.click(getByTestId('workflow-menu-item-change-owner'));
expect(openModalSpy).toHaveBeenCalledWith({
name: PROJECT_MOVE_RESOURCE_MODAL,
data: expect.objectContaining({ resource: expect.objectContaining({ id: workflow.id }) }),
});
});
});
describe('Archived badge', () => {