diff --git a/packages/editor-ui/src/__tests__/data/canvas.ts b/packages/editor-ui/src/__tests__/data/canvas.ts index 6455c6dec5b98..ffd98945c9a53 100644 --- a/packages/editor-ui/src/__tests__/data/canvas.ts +++ b/packages/editor-ui/src/__tests__/data/canvas.ts @@ -91,21 +91,24 @@ export function createCanvasNodeProvide({ id = 'node', label = 'Test Node', selected = false, + readOnly = false, data = {}, eventBus = createEventBus(), }: { id?: string; label?: string; selected?: boolean; + readOnly?: boolean; data?: Partial; eventBus?: EventBus; } = {}) { - const props = createCanvasNodeProps({ id, label, selected, data }); + const props = createCanvasNodeProps({ id, label, selected, readOnly, data }); return { [`${CanvasNodeKey}`]: { id: ref(props.id), label: ref(props.label), selected: ref(props.selected), + readOnly: ref(props.readOnly), data: ref(props.data), eventBus: ref(eventBus), } satisfies CanvasNodeInjectionData, diff --git a/packages/editor-ui/src/components/canvas/elements/nodes/render-types/CanvasNodeStickyNote.spec.ts b/packages/editor-ui/src/components/canvas/elements/nodes/render-types/CanvasNodeStickyNote.spec.ts index b417b33c0e148..e56b3cef63b57 100644 --- a/packages/editor-ui/src/components/canvas/elements/nodes/render-types/CanvasNodeStickyNote.spec.ts +++ b/packages/editor-ui/src/components/canvas/elements/nodes/render-types/CanvasNodeStickyNote.spec.ts @@ -13,7 +13,7 @@ beforeEach(() => { describe('CanvasNodeStickyNote', () => { it('should render node correctly', () => { - const { getByTestId } = renderComponent({ + const { html } = renderComponent({ global: { provide: { ...createCanvasNodeProvide({ @@ -23,6 +23,23 @@ describe('CanvasNodeStickyNote', () => { }, }); - expect(getByTestId('canvas-sticky-note-node')).toMatchSnapshot(); + expect(html()).toMatchSnapshot(); + }); + + it('should disable resizing when node is readonly', () => { + const { container } = renderComponent({ + global: { + provide: { + ...createCanvasNodeProvide({ + id: 'sticky', + readOnly: true, + }), + }, + }, + }); + + const resizeControls = container.querySelectorAll('.vue-flow__resize-control'); + + expect(resizeControls).toHaveLength(0); }); }); diff --git a/packages/editor-ui/src/components/canvas/elements/nodes/render-types/__snapshots__/CanvasNodeStickyNote.spec.ts.snap b/packages/editor-ui/src/components/canvas/elements/nodes/render-types/__snapshots__/CanvasNodeStickyNote.spec.ts.snap index d5b40b411fb2e..211bab169fefe 100644 --- a/packages/editor-ui/src/components/canvas/elements/nodes/render-types/__snapshots__/CanvasNodeStickyNote.spec.ts.snap +++ b/packages/editor-ui/src/components/canvas/elements/nodes/render-types/__snapshots__/CanvasNodeStickyNote.spec.ts.snap @@ -1,45 +1,27 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`CanvasNodeStickyNote > should render node correctly 1`] = ` -
-
-
-
+"
+
+
+
+
+
+
+
+
+
+
+
- " `;