| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <UnitTester testDir="Validators/SocialSecurityValidator/Properties/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="Validators_SocialSecurity_Basic.mxml"> |
| |
| <!-- this set of lines form a tSSNplate that must be in each unit test --> |
| <mx:Script> |
| <![CDATA[ |
| public static function init(o:DisplayObject):void |
| { |
| |
| } |
| ]]> |
| </mx:Script> |
| <mx:Metadata> |
| <![CDATA[ |
| [Mixin] |
| ]]> |
| </mx:Metadata> |
| <!-- end of set of lines that must be in each unit test --> |
| |
| <mx:Script> |
| <![CDATA[ |
| import mx.controls.TextInput; |
| import mx.validators.SocialSecurityValidator; |
| import mx.validators.ValidationResult; |
| import mx.managers.SystemManager; |
| |
| ]]> |
| </mx:Script> |
| |
| <testCases> |
| <TestCase testID="SocialSecurityValidator_allowedFormatChars_default" keywords="[allowedFormatChars, SocialSecurityValidator]"> |
| <setup> |
| <ResetComponent target="myCustomSSN" className="CustomSSN" waitEvent="updateComplete" waitTarget="myCustomSSN"/> |
| <SetProperty target="myCustomSSN.mySSN" propertyName="property" value="text"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomSSN.ti1" propertyName="text" value="944854361" waitEvent="updateComplete" waitTarget="myCustomSSN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomSSN.mySSN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomSSN.mySSN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="SocialSecurityValidator_allowedFormatChars_1" keywords="[allowedFormatChars, SocialSecurityValidator]"> |
| <setup> |
| <ResetComponent target="myCustomSSN" className="CustomSSN" waitEvent="updateComplete" waitTarget="myCustomSSN"/> |
| <SetProperty target="myCustomSSN.mySSN" propertyName="property" value="text"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomSSN.ti1" propertyName="text" value="944-85-3610" waitEvent="updateComplete" waitTarget="myCustomSSN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomSSN.mySSN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomSSN.mySSN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="SocialSecurityValidator_allowedFormatChars_3" keywords="[allowedFormatChars, SocialSecurityValidator]"> |
| <setup> |
| <ResetComponent target="myCustomSSN" className="CustomSSN" waitEvent="updateComplete" waitTarget="myCustomSSN"/> |
| <SetProperty target="myCustomSSN.mySSN" propertyName="property" value="text"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomSSN.ti1" propertyName="text" value="944 85 3610" waitEvent="updateComplete" waitTarget="myCustomSSN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomSSN.mySSN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomSSN.mySSN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="SocialSecurityValidator_allowedFormatChars_6" keywords="[allowedFormatChars, SocialSecurityValidator]"> |
| <setup> |
| <ResetComponent target="myCustomSSN" className="CustomSSN" waitEvent="updateComplete" waitTarget="myCustomSSN"/> |
| <SetProperty target="myCustomSSN.mySSN" propertyName="property" value="text"/> |
| <SetProperty target="myCustomSSN.mySSN" propertyName="allowedFormatChars" value="%"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomSSN.ti1" propertyName="text" value="944%85%3610" waitEvent="updateComplete" waitTarget="myCustomSSN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomSSN.mySSN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomSSN.mySSN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="SocialSecurityValidator_allowedFormatChars_7" keywords="[allowedFormatChars, SocialSecurityValidator]"> |
| <setup> |
| <ResetComponent target="myCustomSSN" className="CustomSSN" waitEvent="updateComplete" waitTarget="myCustomSSN"/> |
| <SetProperty target="myCustomSSN.mySSN" propertyName="property" value="text"/> |
| <SetProperty target="myCustomSSN.mySSN" propertyName="allowedFormatChars" value="s"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomSSN.ti1" propertyName="text" value="944s85s3610" waitEvent="updateComplete" waitTarget="myCustomSSN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomSSN.mySSN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomSSN.mySSN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="SocialSecurityValidator_allowedFormatChars_8" keywords="[allowedFormatChars, SocialSecurityValidator]"> |
| <setup> |
| <ResetComponent target="myCustomSSN" className="CustomSSN" waitEvent="updateComplete" waitTarget="myCustomSSN"/> |
| <SetProperty target="myCustomSSN.mySSN" propertyName="property" value="text"/> |
| <SetProperty target="myCustomSSN.mySSN" propertyName="allowedFormatChars" value="è"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomSSN.ti1" propertyName="text" value="944è85è3610" waitEvent="updateComplete" waitTarget="myCustomSSN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomSSN.mySSN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomSSN.mySSN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="SocialSecurityValidator_allowedFormatChars_9" keywords="[allowedFormatChars, SocialSecurityValidator]"> |
| <setup> |
| <ResetComponent target="myCustomSSN" className="CustomSSN" waitEvent="updateComplete" waitTarget="myCustomSSN"/> |
| <SetProperty target="myCustomSSN.mySSN" propertyName="property" value="text"/> |
| <SetProperty target="myCustomSSN.mySSN" propertyName="allowedFormatChars" value="a"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomSSN.ti1" propertyName="text" value="944a85a3610" waitEvent="updateComplete" waitTarget="myCustomSSN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomSSN.mySSN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomSSN.mySSN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="SocialSecurityValidator_invalidCharError" keywords="[invalidCharError, SocialSecurityValidator]"> |
| <setup> |
| |
| <ResetComponent target="myCustomSSN" className="CustomSSN" waitEvent="updateComplete" waitTarget="myCustomSSN"/> |
| <SetProperty target="myCustomSSN.mySSN" propertyName="property" value="text"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomSSN.ti1" propertyName="text" value="K9488543610" waitEvent="updateComplete" waitTarget="myCustomSSN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomSSN.mySSN" eventName="invalid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomSSN.mySSN" eventName="valid" /> |
| <DispatchMouseEvent target="myCustomSSN.ti1" type="mouseOver" localX="10" localY="10" waitEvent="toolTipShown" waitTarget="myCustomSSN.ti1" /> |
| <WaitForEffectsToEnd /> |
| <CompareBitmap target="" url="../Properties/baselines/invalidCharError.png" timeout="2000" /> |
| </body> |
| </TestCase> |
| <TestCase testID="SocialSecurityValidator_wrongFormatError" keywords="[wrongFormatError, SocialSecurityValidator]"> |
| <setup> |
| |
| <ResetComponent target="myCustomSSN" className="CustomSSN" waitEvent="updateComplete" waitTarget="myCustomSSN"/> |
| <SetProperty target="myCustomSSN.mySSN" propertyName="property" value="text"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomSSN.ti1" propertyName="text" value="988-45-44926" waitEvent="updateComplete" waitTarget="myCustomSSN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomSSN.mySSN" eventName="invalid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomSSN.mySSN" eventName="valid" /> |
| <DispatchMouseEvent target="myCustomSSN.ti1" type="mouseOver" localX="10" localY="10" waitEvent="toolTipShown" waitTarget="myCustomSSN.ti1" /> |
| <WaitForEffectsToEnd /> |
| <CompareBitmap target="" url="../Properties/baselines/wrongFormatError.png" timeout="2000" /> |
| </body> |
| </TestCase> |
| <TestCase testID="SocialSecurityValidator_zeroStartError" keywords="[zeroStartError, SocialSecurityValidator]"> |
| <setup> |
| |
| <ResetComponent target="myCustomSSN" className="CustomSSN" waitEvent="updateComplete" waitTarget="myCustomSSN"/> |
| <SetProperty target="myCustomSSN.mySSN" propertyName="property" value="text"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomSSN.ti1" propertyName="text" value="000-45-4260" waitEvent="updateComplete" waitTarget="myCustomSSN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomSSN.mySSN" eventName="invalid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomSSN.mySSN" eventName="valid" /> |
| <DispatchMouseEvent target="myCustomSSN.ti1" type="mouseOver" localX="10" localY="10" waitEvent="toolTipShown" waitTarget="myCustomSSN.ti1" /> |
| <WaitForEffectsToEnd /> |
| <CompareBitmap target="" url="../Properties/baselines/zeroStartError.png" timeout="2000" /> |
| </body> |
| </TestCase> |
| </testCases> |
| </UnitTester> |