diff --git a/packages/editor-ui/src/components/FilterConditions/__tests__/utils.test.ts b/packages/editor-ui/src/components/FilterConditions/__tests__/utils.test.ts index c92ab709f1..9cb5a1d8ed 100644 --- a/packages/editor-ui/src/components/FilterConditions/__tests__/utils.test.ts +++ b/packages/editor-ui/src/components/FilterConditions/__tests__/utils.test.ts @@ -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', + }, + }); }); }); }); diff --git a/packages/editor-ui/src/components/FilterConditions/utils.ts b/packages/editor-ui/src/components/FilterConditions/utils.ts index d52468bbd2..d26bcc74d1 100644 --- a/packages/editor-ui/src/components/FilterConditions/utils.ts +++ b/packages/editor-ui/src/components/FilterConditions/utils.ts @@ -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; };