@ukhomeoffice/cop-react-form-renderer 5.2.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -77,8 +77,8 @@ var meetsCondition = function meetsCondition(condition, value, data) {
|
|
|
77
77
|
if (!value || !compare) {
|
|
78
78
|
return false;
|
|
79
79
|
}
|
|
80
|
-
var _valFloat = parseFloat(value.replace(
|
|
81
|
-
var _compareFloat = parseFloat(compare.replace(
|
|
80
|
+
var _valFloat = parseFloat(value.replace(/,/g, ''));
|
|
81
|
+
var _compareFloat = parseFloat(compare.replace(/,/g, ''));
|
|
82
82
|
return _valFloat > _compareFloat;
|
|
83
83
|
}
|
|
84
84
|
case 'contains':
|
|
@@ -502,6 +502,13 @@ describe('utils.Condition.meetsCondition', function () {
|
|
|
502
502
|
};
|
|
503
503
|
expect((0, _meetsCondition.default)(CONDITION, '99')).toBeTruthy();
|
|
504
504
|
});
|
|
505
|
+
it('less than should handle values with commas in', function () {
|
|
506
|
+
var CONDITION = {
|
|
507
|
+
op: '<',
|
|
508
|
+
value: '10,000'
|
|
509
|
+
};
|
|
510
|
+
expect((0, _meetsCondition.default)(CONDITION, '9,999')).toBeTruthy();
|
|
511
|
+
});
|
|
505
512
|
it('greater than should reject when value is null', function () {
|
|
506
513
|
var CONDITION = {
|
|
507
514
|
op: '>',
|
|
@@ -537,6 +544,13 @@ describe('utils.Condition.meetsCondition', function () {
|
|
|
537
544
|
};
|
|
538
545
|
expect((0, _meetsCondition.default)(CONDITION, '101')).toBeTruthy();
|
|
539
546
|
});
|
|
547
|
+
it('greater than should handle values with commas in', function () {
|
|
548
|
+
var CONDITION = {
|
|
549
|
+
op: '>',
|
|
550
|
+
value: '10,000'
|
|
551
|
+
};
|
|
552
|
+
expect((0, _meetsCondition.default)(CONDITION, '10,000,000')).toBeTruthy();
|
|
553
|
+
});
|
|
540
554
|
});
|
|
541
555
|
describe('operator includes', function () {
|
|
542
556
|
it('should accept a string that exists within the value', function () {
|