mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 03:42:16 +00:00
feat: Add sticky notes support to the new canvas (no-changelog) (#10031)
This commit is contained in:
@@ -12,14 +12,14 @@ import {
|
||||
mockNodes,
|
||||
mockNodeTypeDescription,
|
||||
} from '@/__tests__/mocks';
|
||||
import { MANUAL_TRIGGER_NODE_TYPE, SET_NODE_TYPE } from '@/constants';
|
||||
import { MANUAL_TRIGGER_NODE_TYPE, SET_NODE_TYPE, STICKY_NODE_TYPE } from '@/constants';
|
||||
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import {
|
||||
createCanvasConnectionHandleString,
|
||||
createCanvasConnectionId,
|
||||
} from '@/utils/canvasUtilsV2';
|
||||
import { CanvasConnectionMode } from '@/types';
|
||||
import { CanvasConnectionMode, CanvasNodeRenderType } from '@/types';
|
||||
|
||||
beforeEach(() => {
|
||||
const pinia = createPinia();
|
||||
@@ -86,6 +86,7 @@ describe('useCanvasMapping', () => {
|
||||
position: expect.anything(),
|
||||
data: {
|
||||
id: manualTriggerNode.id,
|
||||
name: manualTriggerNode.name,
|
||||
type: manualTriggerNode.type,
|
||||
typeVersion: expect.anything(),
|
||||
disabled: false,
|
||||
@@ -224,6 +225,93 @@ describe('useCanvasMapping', () => {
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
describe('render', () => {
|
||||
it('should handle render options for default node type', () => {
|
||||
const manualTriggerNode = mockNode({
|
||||
name: 'Manual Trigger',
|
||||
type: MANUAL_TRIGGER_NODE_TYPE,
|
||||
disabled: false,
|
||||
});
|
||||
const nodes = [manualTriggerNode];
|
||||
const connections = {};
|
||||
const workflowObject = createTestWorkflowObject({
|
||||
nodes,
|
||||
connections,
|
||||
});
|
||||
|
||||
const { nodes: mappedNodes } = useCanvasMapping({
|
||||
nodes: ref(nodes),
|
||||
connections: ref(connections),
|
||||
workflowObject: ref(workflowObject) as Ref<Workflow>,
|
||||
});
|
||||
|
||||
expect(mappedNodes.value[0]?.data?.render).toEqual({
|
||||
type: CanvasNodeRenderType.Default,
|
||||
options: {
|
||||
configurable: false,
|
||||
configuration: false,
|
||||
trigger: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle render options for addNodes node type', () => {
|
||||
const addNodesNode = mockNode({
|
||||
name: CanvasNodeRenderType.AddNodes,
|
||||
type: CanvasNodeRenderType.AddNodes,
|
||||
disabled: false,
|
||||
});
|
||||
const nodes = [addNodesNode];
|
||||
const connections = {};
|
||||
const workflowObject = createTestWorkflowObject({
|
||||
nodes: [],
|
||||
connections,
|
||||
});
|
||||
|
||||
const { nodes: mappedNodes } = useCanvasMapping({
|
||||
nodes: ref(nodes),
|
||||
connections: ref(connections),
|
||||
workflowObject: ref(workflowObject) as Ref<Workflow>,
|
||||
});
|
||||
|
||||
expect(mappedNodes.value[0]?.data?.render).toEqual({
|
||||
type: CanvasNodeRenderType.AddNodes,
|
||||
options: {},
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle render options for stickyNote node type', () => {
|
||||
const stickyNoteNode = mockNode({
|
||||
name: 'Sticky',
|
||||
type: STICKY_NODE_TYPE,
|
||||
disabled: false,
|
||||
parameters: {
|
||||
width: 200,
|
||||
height: 200,
|
||||
color: 3,
|
||||
content: '# Hello world',
|
||||
},
|
||||
});
|
||||
const nodes = [stickyNoteNode];
|
||||
const connections = {};
|
||||
const workflowObject = createTestWorkflowObject({
|
||||
nodes,
|
||||
connections,
|
||||
});
|
||||
|
||||
const { nodes: mappedNodes } = useCanvasMapping({
|
||||
nodes: ref(nodes),
|
||||
connections: ref(connections),
|
||||
workflowObject: ref(workflowObject) as Ref<Workflow>,
|
||||
});
|
||||
|
||||
expect(mappedNodes.value[0]?.data?.render).toEqual({
|
||||
type: CanvasNodeRenderType.StickyNote,
|
||||
options: stickyNoteNode.parameters,
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('connections', () => {
|
||||
|
||||
Reference in New Issue
Block a user