mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-10-31 02:28:35 +08:00 
			
		
		
		
	Fixes #13932: Fix number validator attributes comparison
This commit is contained in:
		 Evgeniy Moiseenko
					Evgeniy Moiseenko
				
			
				
					committed by
					
						 Alexander Makarov
						Alexander Makarov
					
				
			
			
				
	
			
			
			 Alexander Makarov
						Alexander Makarov
					
				
			
						parent
						
							cfe0bf5cf1
						
					
				
				
					commit
					dfe828f76b
				
			| @ -4,6 +4,7 @@ Yii Framework 2 Change Log | ||||
| 2.0.16 under development | ||||
| ------------------------ | ||||
|  | ||||
| - Bug #13932: Fix number validator attributes comparison (uaoleg, s1lver) | ||||
| - Bug #14039, #16636: Fixed validation for disabled inputs (s1lver, omzy83) | ||||
| - Bug #16425: Check for additional values for disabled confirm dialog (Alex-Code, s1lver) | ||||
| - Enh #14367: In `yii\db\mysql\QueryBuilder` added support fractional seconds for time types for MySQL >= 5.6.4 (konstantin-vl) | ||||
|  | ||||
| @ -286,8 +286,8 @@ yii.validation = (function ($) { | ||||
|             } | ||||
|  | ||||
|             if (options.type === 'number') { | ||||
|                 value = parseFloat(value); | ||||
|                 compareValue = parseFloat(compareValue); | ||||
|                 value = value ? parseFloat(value) : 0; | ||||
|                 compareValue = compareValue ? parseFloat(compareValue) : 0; | ||||
|             } | ||||
|             switch (options.operator) { | ||||
|                 case '==': | ||||
|  | ||||
| @ -1518,6 +1518,41 @@ describe('yii.validation', function () { | ||||
|                 {operator: '<', compareValue: '2', type: 'number'}, | ||||
|                 false | ||||
|             ], | ||||
|             'number type, ">=" operator, 2nd is lower': [ | ||||
|                 10, | ||||
|                 {operator: '>=', compareValue: 2, type: 'number'}, | ||||
|                 true | ||||
|             ], | ||||
|             'number type, "<=" operator, 2nd is lower': [ | ||||
|                 10, | ||||
|                 {operator: '<=', compareValue: 2, type: 'number'}, | ||||
|                 false | ||||
|             ], | ||||
|             'number type, ">" operator, 2nd is lower': [ | ||||
|                 10, | ||||
|                 {operator: '>', compareValue: 2, type: 'number'}, | ||||
|                 true | ||||
|             ], | ||||
|             'number type, ">" operator, compare value undefined': [ | ||||
|                 undefined, | ||||
|                 {operator: '>', compareValue: 2, type: 'number'}, | ||||
|                 false | ||||
|             ], | ||||
|             'number type, "<" operator, compare value undefined': [ | ||||
|                 undefined, | ||||
|                 {operator: '<', compareValue: 2, type: 'number'}, | ||||
|                 true | ||||
|             ], | ||||
|             'number type, ">=" operator, compare value undefined': [ | ||||
|                 undefined, | ||||
|                 {operator: '>=', compareValue: 2, type: 'number'}, | ||||
|                 false | ||||
|             ], | ||||
|             'number type, "<=" operator, compare value undefined': [ | ||||
|                 undefined, | ||||
|                 {operator: '<=', compareValue: 2, type: 'number'}, | ||||
|                 true | ||||
|             ], | ||||
|             // default compare value | ||||
|             'default compare value, "===" operator, against undefined': [undefined, {operator: '==='}, true] | ||||
|         }, function (value, options, expectValid) { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user