mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-25 19:41:14 -08:00
fix(editor): Correctly set condition operator when changed (#8700)
This commit is contained in:
parent
35245694b1
commit
23a1bc40a2
|
@ -12,16 +12,15 @@ describe('FilterConditions > utils', () => {
|
|||
expect(
|
||||
handleOperatorChange({
|
||||
condition,
|
||||
newOperator: getFilterOperator('number:equals'),
|
||||
newOperator: getFilterOperator('number:gt'),
|
||||
}),
|
||||
).toEqual({
|
||||
id: '1',
|
||||
leftValue: 45,
|
||||
rightValue: 'notANumber',
|
||||
operator: {
|
||||
name: 'filter.operator.equals',
|
||||
operation: 'equals',
|
||||
type: 'string',
|
||||
operation: 'gt',
|
||||
type: 'number',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -36,16 +35,15 @@ describe('FilterConditions > utils', () => {
|
|||
expect(
|
||||
handleOperatorChange({
|
||||
condition,
|
||||
newOperator: getFilterOperator('boolean:equals'),
|
||||
newOperator: getFilterOperator('boolean:notEquals'),
|
||||
}),
|
||||
).toEqual({
|
||||
id: '1',
|
||||
leftValue: false,
|
||||
rightValue: true,
|
||||
operator: {
|
||||
name: 'filter.operator.equals',
|
||||
operation: 'equals',
|
||||
type: 'string',
|
||||
operation: 'notEquals',
|
||||
type: 'boolean',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -62,7 +60,15 @@ describe('FilterConditions > utils', () => {
|
|||
condition,
|
||||
newOperator: getFilterOperator('boolean:equals'),
|
||||
}),
|
||||
).toEqual(condition);
|
||||
).toEqual({
|
||||
id: '1',
|
||||
leftValue: '={{ $json.foo }}',
|
||||
rightValue: '={{ $("nodename").foo }}',
|
||||
operator: {
|
||||
operation: 'equals',
|
||||
type: 'boolean',
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -46,6 +46,13 @@ export const handleOperatorChange = ({
|
|||
condition.rightValue = convertToType(condition.rightValue, newRightType);
|
||||
}
|
||||
|
||||
condition.operator = {
|
||||
type: newOperator.type,
|
||||
operation: newOperator.operation,
|
||||
rightType: newOperator.rightType,
|
||||
singleValue: newOperator.singleValue,
|
||||
};
|
||||
|
||||
return condition;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue