mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
feat(editor): Add undo/redo create connection in new canvas (no-changelog) (#10141)
This commit is contained in:
@@ -708,6 +708,24 @@ describe('useCanvasOperations', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('revertCreateConnection', () => {
|
||||
it('deletes connection if both source and target nodes exist', () => {
|
||||
const connection: [IConnection, IConnection] = [
|
||||
{ node: 'sourceNode', type: NodeConnectionType.Main, index: 0 },
|
||||
{ node: 'targetNode', type: NodeConnectionType.Main, index: 0 },
|
||||
];
|
||||
const testNode = createTestNode();
|
||||
|
||||
const removeConnectionSpy = vi.spyOn(workflowsStore, 'removeConnection');
|
||||
vi.spyOn(workflowsStore, 'getNodeByName').mockReturnValue(testNode);
|
||||
vi.spyOn(workflowsStore, 'getNodeById').mockReturnValue(testNode);
|
||||
|
||||
canvasOperations.revertCreateConnection(connection);
|
||||
|
||||
expect(removeConnectionSpy).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('isConnectionAllowed', () => {
|
||||
it('should return false if source and target nodes are the same', () => {
|
||||
const node = mockNode({ id: '1', type: 'testType', name: 'Test Node' });
|
||||
|
||||
Reference in New Issue
Block a user