mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 21:07:28 -08:00
🐛 Fix issue with default value for multipleValues string with none
stanard default value
This commit is contained in:
parent
b9b6e8b5df
commit
e18370cb10
|
@ -612,9 +612,8 @@ export function getNodeParameters(nodePropertiesArray: INodeProperties[], nodeVa
|
|||
if (nodeValues[nodeProperties.name] !== undefined) {
|
||||
nodeParameters[nodeProperties.name] = nodeValues[nodeProperties.name];
|
||||
} else if (returnDefaults === true) {
|
||||
// Does not have values defined but defaults should be returned which is in the
|
||||
// case of a collection with multipleValues always an empty array
|
||||
nodeParameters[nodeProperties.name] = [];
|
||||
// Does not have values defined but defaults should be returned
|
||||
nodeParameters[nodeProperties.name] = JSON.parse(JSON.stringify(nodeProperties.default));
|
||||
}
|
||||
nodeParametersFull[nodeProperties.name] = nodeParameters[nodeProperties.name];
|
||||
} else {
|
||||
|
|
|
@ -2174,7 +2174,7 @@ describe('Workflow', () => {
|
|||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
default: {},
|
||||
default: [],
|
||||
options: [
|
||||
{
|
||||
displayName: 'string1',
|
||||
|
@ -2195,17 +2195,13 @@ describe('Workflow', () => {
|
|||
},
|
||||
output: {
|
||||
noneDisplayedFalse: {
|
||||
defaultsFalse: {
|
||||
// collection1: [],
|
||||
},
|
||||
defaultsFalse: {},
|
||||
defaultsTrue: {
|
||||
collection1: [],
|
||||
},
|
||||
},
|
||||
noneDisplayedTrue: {
|
||||
defaultsFalse: {
|
||||
// collection1: [],
|
||||
},
|
||||
defaultsFalse: {},
|
||||
defaultsTrue: {
|
||||
collection1: [],
|
||||
},
|
||||
|
@ -2940,7 +2936,7 @@ describe('Workflow', () => {
|
|||
},
|
||||
},
|
||||
{
|
||||
description: 'complex type "fixedCollection" with "multipleValues: true". Which contains parameter of type multiOptions and has so an array default value.',
|
||||
description: 'complex type "fixedCollection" with "multipleValues: true". Which contains parameter of type "multiOptions" and has so an array default value',
|
||||
input: {
|
||||
nodePropertiesArray: [
|
||||
{
|
||||
|
@ -3028,6 +3024,88 @@ describe('Workflow', () => {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
description: 'complex type "fixedCollection" with "multipleValues: true". Which contains parameter of type "string" with "multipleValues: true" and a custom default value',
|
||||
input: {
|
||||
nodePropertiesArray: [
|
||||
{
|
||||
name: 'values',
|
||||
displayName: 'Values',
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
name: 'propertyValues',
|
||||
displayName: 'Property',
|
||||
values: [
|
||||
{
|
||||
displayName: 'MultiString',
|
||||
name: 'multiString',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
default: ['value1'],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
nodeValues: {
|
||||
values: {
|
||||
propertyValues: [
|
||||
{
|
||||
multiString: ['value1'],
|
||||
}
|
||||
]
|
||||
},
|
||||
},
|
||||
},
|
||||
output: {
|
||||
noneDisplayedFalse: {
|
||||
defaultsFalse: {
|
||||
values: {
|
||||
propertyValues: [
|
||||
{
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
defaultsTrue: {
|
||||
values: {
|
||||
propertyValues: [
|
||||
{
|
||||
multiString: ['value1'],
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
noneDisplayedTrue: {
|
||||
defaultsFalse: {
|
||||
values: {
|
||||
propertyValues: [
|
||||
{
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
defaultsTrue: {
|
||||
values: {
|
||||
propertyValues: [
|
||||
{
|
||||
multiString: ['value1'],
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue