diff --git a/packages/frontend/editor-ui/src/components/VirtualSchema.test.ts b/packages/frontend/editor-ui/src/components/VirtualSchema.test.ts index be87f2267c0..8f7a23fc734 100644 --- a/packages/frontend/editor-ui/src/components/VirtualSchema.test.ts +++ b/packages/frontend/editor-ui/src/components/VirtualSchema.test.ts @@ -658,7 +658,22 @@ describe('VirtualSchema.vue', () => { expect(container).toMatchSnapshot(); }); - it('should do something', () => { - expect(true).toBe(true); + it('renders schema for empty objects and arrays', async () => { + useWorkflowsStore().pinData({ + node: mockNode1, + data: [{ json: { empty: {}, emptyArray: [], nested: [{ empty: {}, emptyArray: [] }] } }], + }); + + const { container, getAllByTestId } = renderComponent({ + props: { + nodes: [{ name: mockNode1.name, indicies: [], depth: 1 }], + }, + }); + + await waitFor(() => { + const headers = getAllByTestId('run-data-schema-header'); + expect(headers.length).toBe(2); + }); + expect(container).toMatchSnapshot(); }); }); diff --git a/packages/frontend/editor-ui/src/components/VirtualSchema.vue b/packages/frontend/editor-ui/src/components/VirtualSchema.vue index cdd727175ea..9626aa1ec7d 100644 --- a/packages/frontend/editor-ui/src/components/VirtualSchema.vue +++ b/packages/frontend/editor-ui/src/components/VirtualSchema.vue @@ -432,14 +432,12 @@ const onDragEnd = (el: HTMLElement) => { v-else-if="item.type === 'notice'" v-n8n-html="item.message" class="notice" - :style="{ marginLeft: `calc(var(--spacing-l) + var(--spacing-l) * ${item.level})` }" + :style="{ '--schema-level': item.level }" />
{ @@ -507,4 +505,17 @@ const onDragEnd = (el: HTMLElement) => { font-size: var(--font-size-2xs); line-height: var(--font-line-height-loose); } + +.notice { + margin-left: calc(var(--spacing-l) * var(--schema-level)); +} + +.empty-schema { + padding-bottom: var(--spacing-xs); + margin-left: calc((var(--spacing-xl) * var(--schema-level))); +} + +.execute-button { + padding: 0; +} diff --git a/packages/frontend/editor-ui/src/components/__snapshots__/VirtualSchema.test.ts.snap b/packages/frontend/editor-ui/src/components/__snapshots__/VirtualSchema.test.ts.snap index 48e09fbebff..c7ceb192aa6 100644 --- a/packages/frontend/editor-ui/src/components/__snapshots__/VirtualSchema.test.ts.snap +++ b/packages/frontend/editor-ui/src/components/__snapshots__/VirtualSchema.test.ts.snap @@ -910,6 +910,795 @@ exports[`VirtualSchema.vue > renders schema for correct output branch 1`] = `
`; +exports[`VirtualSchema.vue > renders schema for empty objects and arrays 1`] = ` +
+
+ +
+ +
+ + + +
+
+
+ +
+
+
+ + +
+ + +
+ +
+
+
+ Manual Trigger + +
+ +
+ 1 item +
+
+ +
+ + + + +
+
+
+ +
+
+
+ + + + + + empty + + + +
+ + + + +
+ + + + +
+
+
+ +
+
+
+ + + + + + emptyArray + + + +
+ + + + +
+ + + + +
+
+
+ +
+
+
+ + + + + + nested + + + +
+ + + + +
+ + + + +
+
+
+ +
+
+
+ + + + + + nested[0] + + + +
+ + + + +
+ + + + +
+
+
+ +
+
+
+ + + + + + empty + + + +
+ + + + +
+ + + + +
+
+
+ +
+
+
+ + + + + + emptyArray + + + +
+ + + + +
+ + + + +
+
+
+
+ +
+ Variables and context + +
+ + +
+ +
+ + + +
+ + + +
+
+
+`; + exports[`VirtualSchema.vue > renders schema in output pane 1`] = `
renders schema with spaces and dots 1`] = `
renders schema with spaces and dots 1`] = `