mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-10-31 10:39:59 +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 | 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 #14039, #16636: Fixed validation for disabled inputs (s1lver, omzy83) | ||||||
| - Bug #16425: Check for additional values for disabled confirm dialog (Alex-Code, s1lver) | - 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) | - 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') { |             if (options.type === 'number') { | ||||||
|                 value = parseFloat(value); |                 value = value ? parseFloat(value) : 0; | ||||||
|                 compareValue = parseFloat(compareValue); |                 compareValue = compareValue ? parseFloat(compareValue) : 0; | ||||||
|             } |             } | ||||||
|             switch (options.operator) { |             switch (options.operator) { | ||||||
|                 case '==': |                 case '==': | ||||||
|  | |||||||
| @ -1518,6 +1518,41 @@ describe('yii.validation', function () { | |||||||
|                 {operator: '<', compareValue: '2', type: 'number'}, |                 {operator: '<', compareValue: '2', type: 'number'}, | ||||||
|                 false |                 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 | ||||||
|             'default compare value, "===" operator, against undefined': [undefined, {operator: '==='}, true] |             'default compare value, "===" operator, against undefined': [undefined, {operator: '==='}, true] | ||||||
|         }, function (value, options, expectValid) { |         }, function (value, options, expectValid) { | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user