You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cz...@apache.org on 2013/01/23 23:18:35 UTC

svn commit: r1437779 - in /flex/sdk/branches/develop: frameworks/projects/framework/src/mx/validators/ mustella/tests/Validators/EmailValidator/Properties/ mustella/tests/Validators/EmailValidator/Properties/baselines/

Author: czadra
Date: Wed Jan 23 22:18:35 2013
New Revision: 1437779

URL: http://svn.apache.org/viewvc?rev=1437779&view=rev
Log:
FLEX-33192 patch by Benjamin Chalupka, added 2 mustella tests for EmailValidator

Added:
    flex/sdk/branches/develop/mustella/tests/Validators/EmailValidator/Properties/baselines/invalidHyphensInDomainError1.png   (with props)
    flex/sdk/branches/develop/mustella/tests/Validators/EmailValidator/Properties/baselines/invalidHyphensInDomainError2.png   (with props)
Modified:
    flex/sdk/branches/develop/frameworks/projects/framework/src/mx/validators/EmailValidator.as
    flex/sdk/branches/develop/mustella/tests/Validators/EmailValidator/Properties/Validators_Email_Properties.mxml

Modified: flex/sdk/branches/develop/frameworks/projects/framework/src/mx/validators/EmailValidator.as
URL: http://svn.apache.org/viewvc/flex/sdk/branches/develop/frameworks/projects/framework/src/mx/validators/EmailValidator.as?rev=1437779&r1=1437778&r2=1437779&view=diff
==============================================================================
--- flex/sdk/branches/develop/frameworks/projects/framework/src/mx/validators/EmailValidator.as (original)
+++ flex/sdk/branches/develop/frameworks/projects/framework/src/mx/validators/EmailValidator.as Wed Jan 23 22:18:35 2013
@@ -242,8 +242,9 @@ public class EmailValidator extends Vali
 				}
 			}
 			
-			// Check that the character immediately after the @ is not a period.
-			if (domain.charAt(0) == ".")
+			// Check that the character immediately after the @ is not a period or an hyphen.
+			// And check that the character before the period is not an hyphen.
+			if (domain.charAt(0) == "." || domain.charAt(0) == "-" || domain.charAt(periodPos - 1) == "-")
 			{
 				results.push(new ValidationResult(
 					true, baseField, "invalidDomain",

Modified: flex/sdk/branches/develop/mustella/tests/Validators/EmailValidator/Properties/Validators_Email_Properties.mxml
URL: http://svn.apache.org/viewvc/flex/sdk/branches/develop/mustella/tests/Validators/EmailValidator/Properties/Validators_Email_Properties.mxml?rev=1437779&r1=1437778&r2=1437779&view=diff
==============================================================================
--- flex/sdk/branches/develop/mustella/tests/Validators/EmailValidator/Properties/Validators_Email_Properties.mxml (original)
+++ flex/sdk/branches/develop/mustella/tests/Validators/EmailValidator/Properties/Validators_Email_Properties.mxml Wed Jan 23 22:18:35 2013
@@ -175,6 +175,40 @@
 				<CompareBitmap target="" url="../Properties/baselines/invalidPeriodsInDomainError.png" timeout="2000" />				
 			</body>  
 		</TestCase>
+		<TestCase testID="EmailValidator_invalidHyphensInDomainError1"  keywords="[invalidHyphensInDomainError, EmailValidator]">
+			<setup>
+				
+				<ResetComponent target="myCustomEm" className="CustomEm"  waitEvent="updateComplete" waitTarget="myCustomEm"/>
+				<SetProperty target="myCustomEm.myEm" propertyName="property" value="text"/>
+				<SetProperty target="myCustomEm.ti1" propertyName="text" value="mavenkisatd@-ydomain.com" waitEvent="updateComplete" waitTarget="myCustomEm.ti1"/>
+				<WaitForEffectsToEnd />
+			</setup>
+			<body>
+				<DispatchKeyEvent keys="[TAB, TAB]"/>
+				<AssertEvent target="myCustomEm.myEm" eventName="invalid" eventClass="mx.events::ValidationResultEvent" />
+				<AssertNoEvent target="myCustomEm.myEm" eventName="valid" />
+				<DispatchMouseEvent target="myCustomEm.ti1" type="mouseOver" localX="10" localY="10"  waitEvent="toolTipShown" waitTarget="myCustomEm.ti1"/>
+				<WaitForEffectsToEnd />
+				<CompareBitmap target="" url="../Properties/baselines/invalidHyphensInDomainError1.png" timeout="2000" />				
+			</body>  
+		</TestCase>
+				<TestCase testID="EmailValidator_invalidHyphensInDomainError2"  keywords="[invalidHyphensInDomainError, EmailValidator]">
+			<setup>
+				
+				<ResetComponent target="myCustomEm" className="CustomEm"  waitEvent="updateComplete" waitTarget="myCustomEm"/>
+				<SetProperty target="myCustomEm.myEm" propertyName="property" value="text"/>
+				<SetProperty target="myCustomEm.ti1" propertyName="text" value="mavenkisatd@ydomain-.com" waitEvent="updateComplete" waitTarget="myCustomEm.ti1"/>
+				<WaitForEffectsToEnd />
+			</setup>
+			<body>
+				<DispatchKeyEvent keys="[TAB, TAB]"/>
+				<AssertEvent target="myCustomEm.myEm" eventName="invalid" eventClass="mx.events::ValidationResultEvent" />
+				<AssertNoEvent target="myCustomEm.myEm" eventName="valid" />
+				<DispatchMouseEvent target="myCustomEm.ti1" type="mouseOver" localX="10" localY="10"  waitEvent="toolTipShown" waitTarget="myCustomEm.ti1"/>
+				<WaitForEffectsToEnd />
+				<CompareBitmap target="" url="../Properties/baselines/invalidHyphensInDomainError2.png" timeout="2000" />				
+			</body>  
+		</TestCase>
 		<TestCase testID="EmailValidator_missingPeriodInDomainError"  keywords="[missingPeriodInDomainError, EmailValidator]">
 			<setup>
 				

Added: flex/sdk/branches/develop/mustella/tests/Validators/EmailValidator/Properties/baselines/invalidHyphensInDomainError1.png
URL: http://svn.apache.org/viewvc/flex/sdk/branches/develop/mustella/tests/Validators/EmailValidator/Properties/baselines/invalidHyphensInDomainError1.png?rev=1437779&view=auto
==============================================================================
Binary file - no diff available.

Propchange: flex/sdk/branches/develop/mustella/tests/Validators/EmailValidator/Properties/baselines/invalidHyphensInDomainError1.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: flex/sdk/branches/develop/mustella/tests/Validators/EmailValidator/Properties/baselines/invalidHyphensInDomainError2.png
URL: http://svn.apache.org/viewvc/flex/sdk/branches/develop/mustella/tests/Validators/EmailValidator/Properties/baselines/invalidHyphensInDomainError2.png?rev=1437779&view=auto
==============================================================================
Binary file - no diff available.

Propchange: flex/sdk/branches/develop/mustella/tests/Validators/EmailValidator/Properties/baselines/invalidHyphensInDomainError2.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream