diff --git a/packages/editor-ui/src/components/FixedCollectionParameter.test.ts b/packages/editor-ui/src/components/FixedCollectionParameter.test.ts new file mode 100644 index 0000000000..d77d0f0ae2 --- /dev/null +++ b/packages/editor-ui/src/components/FixedCollectionParameter.test.ts @@ -0,0 +1,83 @@ +import { renderComponent } from '@/__tests__/render'; +import FixedCollectionParameter from './FixedCollectionParameter.vue'; +import { createPinia, setActivePinia } from 'pinia'; +import { createAppModals } from '@/__tests__/utils'; + +describe('FixedCollectionParameter', () => { + beforeEach(() => { + createAppModals(); + const pinia = createPinia(); + setActivePinia(pinia); + }); + + it('renders default options correctly', () => { + const { html } = renderComponent(FixedCollectionParameter, { + global: { + stubs: ['ParameterInputList'], + }, + props: { + parameter: { + displayName: 'Categories', + name: 'categories', + placeholder: 'Add Category', + type: 'fixedCollection', + default: {}, + typeOptions: { multipleValues: true }, + options: [ + { + name: 'categories', + displayName: 'Categories', + values: [ + { + displayName: 'Category', + name: 'category', + type: 'string', + default: '', + description: 'Category to add', + required: true, + }, + { + displayName: 'Description', + name: 'description', + type: 'string', + default: '', + description: "Describe your category if it's not obvious", + }, + ], + }, + ], + }, + nodeValues: { + color: '#ff0000', + alwaysOutputData: false, + executeOnce: false, + notesInFlow: false, + onError: 'stopWorkflow', + retryOnFail: false, + maxTries: 3, + waitBetweenTries: 1000, + notes: '', + parameters: { + inputText: '', + categories: { + categories: [ + { category: 'One', description: 'Category one' }, + { category: 'Two', description: 'New Category two' }, + ], + }, + options: {}, + }, + }, + path: 'parameters.categories', + values: { + categories: [ + { category: 'One', description: 'Category one' }, + { category: 'Two', description: 'New Category two' }, + ], + }, + isReadonly: false, + }, + }); + console.log(html); + }); +}); diff --git a/packages/editor-ui/src/components/FixedCollectionParameter.vue b/packages/editor-ui/src/components/FixedCollectionParameter.vue index 98c5ef5971..fe168f39db 100644 --- a/packages/editor-ui/src/components/FixedCollectionParameter.vue +++ b/packages/editor-ui/src/components/FixedCollectionParameter.vue @@ -1,214 +1,199 @@ -