flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject git commit: [flex-sdk] [refs/heads/develop] - FLEX-34378 count multiple separators as an invalid date format
Date Sun, 06 Jul 2014 02:18:08 GMT
Repository: flex-sdk
Updated Branches:
  refs/heads/develop 8a6efb404 -> 0d2342a01


FLEX-34378 count multiple separators as an invalid date format


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/0d2342a0
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/0d2342a0
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/0d2342a0

Branch: refs/heads/develop
Commit: 0d2342a0111474a161ace47aa8b190e00c2943c1
Parents: 8a6efb4
Author: Justin Mclean <jmclean@apache.org>
Authored: Sun Jul 6 12:17:41 2014 +1000
Committer: Justin Mclean <jmclean@apache.org>
Committed: Sun Jul 6 12:17:41 2014 +1000

----------------------------------------------------------------------
 .../framework/src/mx/validators/DateValidator.as     | 15 ++++++++++++++-
 .../Properties/Validators_Date_Properties.mxml       | 15 +++++++++++++++
 .../Properties/Validators_Date_Properties_spark.mxml | 15 +++++++++++++++
 3 files changed, 44 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/0d2342a0/frameworks/projects/framework/src/mx/validators/DateValidator.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/validators/DateValidator.as b/frameworks/projects/framework/src/mx/validators/DateValidator.as
index 89138cc..f833ee2 100644
--- a/frameworks/projects/framework/src/mx/validators/DateValidator.as
+++ b/frameworks/projects/framework/src/mx/validators/DateValidator.as
@@ -211,7 +211,7 @@ public class DateValidator extends Validator
 			else
 			{
 				noSeperators = false;
-				formatParts[part] = formatChar;
+				formatParts[part] += formatChar;
 			}
 			
 			lastFormatChar = formatChar;
@@ -388,6 +388,19 @@ public class DateValidator extends Validator
 						dateObj.year = dateParts[part];
 						yearPart = formatParts[part];
 					}
+					else if (!noSeperators)
+					{
+						// separator part, we have valid separator characters just validate against
+						// repeating separator values, validate now as we could have multiple separators
+						if (dateParts[part].length != formatParts[part].length)
+						{
+							results.push(new ValidationResult(
+								true, baseField, "wrongLength",
+								validator.wrongLengthError
+								+ (DateValidator._includeFormatInError?" " + inputFormat:"")));
+							return results;
+						}
+					}
 				}
 				
 				// DD or D format

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/0d2342a0/mustella/tests/Validators/DateValidator/Properties/Validators_Date_Properties.mxml
----------------------------------------------------------------------
diff --git a/mustella/tests/Validators/DateValidator/Properties/Validators_Date_Properties.mxml
b/mustella/tests/Validators/DateValidator/Properties/Validators_Date_Properties.mxml
index 1432fb6..0cdbfbd 100644
--- a/mustella/tests/Validators/DateValidator/Properties/Validators_Date_Properties.mxml
+++ b/mustella/tests/Validators/DateValidator/Properties/Validators_Date_Properties.mxml
@@ -184,6 +184,21 @@
 				<AssertNoEvent target="myCustomDt.myDt" eventName="invalid" />
 			</body>  
 		</TestCase>
+		<TestCase testID="DateValidator_formatError_tooManySeperators_FLEX34378" keywords="[DateSymbol,
DateValidator]">
+			<setup>
+				
+				<ResetComponent target="myCustomDt" className="CustomDt"  waitEvent="updateComplete"
waitTarget="myCustomDt"/>
+				<SetProperty target="myCustomDt.myDt" propertyName="property" value="text"/>
+				<SetProperty target="myCustomDt.myDt" propertyName="inputFormat" value="MM/DD/YYYY"/>
+				<SetProperty target="myCustomDt.ti1" propertyName="text" value="12////12////2012"
waitEvent="updateComplete" waitTarget="myCustomDt.ti1"/>
+				<WaitForEffectsToEnd />
+			</setup>
+			<body>
+				<DispatchKeyEvent keys="[TAB, TAB]" />
+				<AssertEvent target="myCustomDt.myDt" eventName="invalid" eventClass="mx.events::ValidationResultEvent"
/>
+				<AssertNoEvent target="myCustomDt.myDt" eventName="valid" />
+			</body>  
+		</TestCase>
 
 		<TestCase testID="DateValidator_formatError"  keywords="[DateSymbol, DateValidator]">
 			<setup>

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/0d2342a0/mustella/tests/Validators/DateValidator/Properties/Validators_Date_Properties_spark.mxml
----------------------------------------------------------------------
diff --git a/mustella/tests/Validators/DateValidator/Properties/Validators_Date_Properties_spark.mxml
b/mustella/tests/Validators/DateValidator/Properties/Validators_Date_Properties_spark.mxml
index 997f492..784d6f5 100644
--- a/mustella/tests/Validators/DateValidator/Properties/Validators_Date_Properties_spark.mxml
+++ b/mustella/tests/Validators/DateValidator/Properties/Validators_Date_Properties_spark.mxml
@@ -259,6 +259,21 @@
 				<AssertNoEvent target="myCustomDt.myDt" eventName="invalid" />
 			</body>  
 		</TestCase>
+		<TestCase testID="DateValidator_formatError_tooManySeperators_FLEX34378_spark" keywords="[DateSymbol,
DateValidator]">
+			<setup>
+				
+				<ResetComponent target="myCustomDt" className="CustomDt"  waitEvent="updateComplete"
waitTarget="myCustomDt"/>
+				<SetProperty target="myCustomDt.myDt" propertyName="property" value="text"/>
+				<SetProperty target="myCustomDt.myDt" propertyName="inputFormat" value="MM/DD/YYYY"/>
+				<SetProperty target="myCustomDt.ti1" propertyName="text" value="12////12////2012"
waitEvent="updateComplete" waitTarget="myCustomDt.ti1"/>
+				<WaitForEffectsToEnd />
+			</setup>
+			<body>
+				<DispatchKeyEvent keys="[TAB, TAB]" />
+				<AssertEvent target="myCustomDt.myDt" eventName="invalid" eventClass="mx.events::ValidationResultEvent"
/>
+				<AssertNoEvent target="myCustomDt.myDt" eventName="valid" />
+			</body>  
+		</TestCase>
 		<TestCase testID="DateValidator_formatError_spark" keywords="[DateSymbol, DateValidator]">
 			<setup>
 				


Mime
View raw message