mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -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(
|
expect(
|
||||||
handleOperatorChange({
|
handleOperatorChange({
|
||||||
condition,
|
condition,
|
||||||
newOperator: getFilterOperator('number:equals'),
|
newOperator: getFilterOperator('number:gt'),
|
||||||
}),
|
}),
|
||||||
).toEqual({
|
).toEqual({
|
||||||
id: '1',
|
id: '1',
|
||||||
leftValue: 45,
|
leftValue: 45,
|
||||||
rightValue: 'notANumber',
|
rightValue: 'notANumber',
|
||||||
operator: {
|
operator: {
|
||||||
name: 'filter.operator.equals',
|
operation: 'gt',
|
||||||
operation: 'equals',
|
type: 'number',
|
||||||
type: 'string',
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -36,16 +35,15 @@ describe('FilterConditions > utils', () => {
|
||||||
expect(
|
expect(
|
||||||
handleOperatorChange({
|
handleOperatorChange({
|
||||||
condition,
|
condition,
|
||||||
newOperator: getFilterOperator('boolean:equals'),
|
newOperator: getFilterOperator('boolean:notEquals'),
|
||||||
}),
|
}),
|
||||||
).toEqual({
|
).toEqual({
|
||||||
id: '1',
|
id: '1',
|
||||||
leftValue: false,
|
leftValue: false,
|
||||||
rightValue: true,
|
rightValue: true,
|
||||||
operator: {
|
operator: {
|
||||||
name: 'filter.operator.equals',
|
operation: 'notEquals',
|
||||||
operation: 'equals',
|
type: 'boolean',
|
||||||
type: 'string',
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -62,7 +60,15 @@ describe('FilterConditions > utils', () => {
|
||||||
condition,
|
condition,
|
||||||
newOperator: getFilterOperator('boolean:equals'),
|
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.rightValue = convertToType(condition.rightValue, newRightType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
condition.operator = {
|
||||||
|
type: newOperator.type,
|
||||||
|
operation: newOperator.operation,
|
||||||
|
rightType: newOperator.rightType,
|
||||||
|
singleValue: newOperator.singleValue,
|
||||||
|
};
|
||||||
|
|
||||||
return condition;
|
return condition;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue