| <?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/PhoneNumberValidator/Properties/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="Validators_PhoneNumber_Basic.mxml"> |
| |
| <!-- this set of lines form a tPhNplate 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.PhoneNumberValidator; |
| import mx.validators.ValidationResult; |
| import mx.managers.SystemManager; |
| |
| ]]> |
| </mx:Script> |
| |
| <testCases> |
| <TestCase testID="PhoneNumberValidator_allowedFormatChars_default" keywords="[allowedFormatChars, PhoneNumberValidator]"> |
| <setup> |
| <ResetComponent target="myCustomPhN" className="CustomPhN" waitEvent="updateComplete" waitTarget="myCustomPhN"/> |
| <SetProperty target="myCustomPhN.myPhN" propertyName="property" value="text"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomPhN.ti1" propertyName="text" value="9448543610" waitEvent="updateComplete" waitTarget="myCustomPhN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomPhN.myPhN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomPhN.myPhN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="PhoneNumberValidator_allowedFormatChars_1" keywords="[allowedFormatChars, PhoneNumberValidator]"> |
| <setup> |
| <ResetComponent target="myCustomPhN" className="CustomPhN" waitEvent="updateComplete" waitTarget="myCustomPhN"/> |
| <SetProperty target="myCustomPhN.myPhN" propertyName="property" value="text"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomPhN.ti1" propertyName="text" value="(944)(854)(3610)" waitEvent="updateComplete" waitTarget="myCustomPhN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomPhN.myPhN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomPhN.myPhN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="PhoneNumberValidator_allowedFormatChars_2" keywords="[allowedFormatChars, PhoneNumberValidator]"> |
| <setup> |
| <ResetComponent target="myCustomPhN" className="CustomPhN" waitEvent="updateComplete" waitTarget="myCustomPhN"/> |
| <SetProperty target="myCustomPhN.myPhN" propertyName="property" value="text"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomPhN.ti1" propertyName="text" value="944-854-3610" waitEvent="updateComplete" waitTarget="myCustomPhN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomPhN.myPhN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomPhN.myPhN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="PhoneNumberValidator_allowedFormatChars_3" keywords="[allowedFormatChars, PhoneNumberValidator]"> |
| <setup> |
| <ResetComponent target="myCustomPhN" className="CustomPhN" waitEvent="updateComplete" waitTarget="myCustomPhN"/> |
| <SetProperty target="myCustomPhN.myPhN" propertyName="property" value="text"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomPhN.ti1" propertyName="text" value="944 854 3610" waitEvent="updateComplete" waitTarget="myCustomPhN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomPhN.myPhN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomPhN.myPhN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="PhoneNumberValidator_allowedFormatChars_4" keywords="[allowedFormatChars, PhoneNumberValidator]"> |
| <setup> |
| <ResetComponent target="myCustomPhN" className="CustomPhN" waitEvent="updateComplete" waitTarget="myCustomPhN"/> |
| <SetProperty target="myCustomPhN.myPhN" propertyName="property" value="text"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomPhN.ti1" propertyName="text" value="944.854.3610" waitEvent="updateComplete" waitTarget="myCustomPhN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomPhN.myPhN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomPhN.myPhN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="PhoneNumberValidator_allowedFormatChars_5" keywords="[allowedFormatChars, PhoneNumberValidator]"> |
| <setup> |
| <ResetComponent target="myCustomPhN" className="CustomPhN" waitEvent="updateComplete" waitTarget="myCustomPhN"/> |
| <SetProperty target="myCustomPhN.myPhN" propertyName="property" value="text"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomPhN.ti1" propertyName="text" value="944+854+3610" waitEvent="updateComplete" waitTarget="myCustomPhN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomPhN.myPhN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomPhN.myPhN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="PhoneNumberValidator_allowedFormatChars_6" keywords="[allowedFormatChars, PhoneNumberValidator]"> |
| <setup> |
| <ResetComponent target="myCustomPhN" className="CustomPhN" waitEvent="updateComplete" waitTarget="myCustomPhN"/> |
| <SetProperty target="myCustomPhN.myPhN" propertyName="property" value="text"/> |
| <SetProperty target="myCustomPhN.myPhN" propertyName="allowedFormatChars" value="%"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomPhN.ti1" propertyName="text" value="944%854%3610" waitEvent="updateComplete" waitTarget="myCustomPhN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomPhN.myPhN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomPhN.myPhN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="PhoneNumberValidator_allowedFormatChars_7" keywords="[allowedFormatChars, PhoneNumberValidator]"> |
| <setup> |
| <ResetComponent target="myCustomPhN" className="CustomPhN" waitEvent="updateComplete" waitTarget="myCustomPhN"/> |
| <SetProperty target="myCustomPhN.myPhN" propertyName="property" value="text"/> |
| <SetProperty target="myCustomPhN.myPhN" propertyName="allowedFormatChars" value="sg"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomPhN.ti1" propertyName="text" value="944sg854sg3610" waitEvent="updateComplete" waitTarget="myCustomPhN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomPhN.myPhN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomPhN.myPhN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="PhoneNumberValidator_allowedFormatChars_8" keywords="[allowedFormatChars, PhoneNumberValidator]"> |
| <setup> |
| <ResetComponent target="myCustomPhN" className="CustomPhN" waitEvent="updateComplete" waitTarget="myCustomPhN"/> |
| <SetProperty target="myCustomPhN.myPhN" propertyName="property" value="text"/> |
| <SetProperty target="myCustomPhN.myPhN" propertyName="allowedFormatChars" value="tráçè"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomPhN.ti1" propertyName="text" value="944tráçè854tráçè3610" waitEvent="updateComplete" waitTarget="myCustomPhN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomPhN.myPhN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomPhN.myPhN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="PhoneNumberValidator_allowedFormatChars_9" keywords="[allowedFormatChars, PhoneNumberValidator]"> |
| <setup> |
| <ResetComponent target="myCustomPhN" className="CustomPhN" waitEvent="updateComplete" waitTarget="myCustomPhN"/> |
| <SetProperty target="myCustomPhN.myPhN" propertyName="property" value="text"/> |
| <SetProperty target="myCustomPhN.myPhN" propertyName="allowedFormatChars" value="abcd"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomPhN.ti1" propertyName="text" value="944abcd854abcd3610" waitEvent="updateComplete" waitTarget="myCustomPhN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomPhN.myPhN" eventName="valid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomPhN.myPhN" eventName="invalid" /> |
| </body> |
| </TestCase> |
| <TestCase testID="PhoneNumberValidator_invalidCharError" keywords="[invalidCharError, PhoneNumberValidator]"> |
| <setup> |
| |
| <ResetComponent target="myCustomPhN" className="CustomPhN" waitEvent="updateComplete" waitTarget="myCustomPhN"/> |
| <SetProperty target="myCustomPhN.myPhN" propertyName="property" value="text"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomPhN.ti1" propertyName="text" value="K9488543610" waitEvent="updateComplete" waitTarget="myCustomPhN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomPhN.myPhN" eventName="invalid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomPhN.myPhN" eventName="valid" /> |
| <DispatchMouseEvent target="myCustomPhN.ti1" type="mouseOver" localX="10" localY="10" waitEvent="toolTipShown" waitTarget="myCustomPhN.ti1"/> |
| <WaitForEffectsToEnd /> |
| <CompareBitmap target="" url="../Properties/baselines/invalidCharError.png" timeout="2000" /> |
| </body> |
| </TestCase> |
| <TestCase testID="PhoneNumberValidator_wrongLengthError" keywords="[wrongLengthError, PhoneNumberValidator]"> |
| <setup> |
| |
| <ResetComponent target="myCustomPhN" className="CustomPhN" waitEvent="updateComplete" waitTarget="myCustomPhN"/> |
| <SetProperty target="myCustomPhN.myPhN" propertyName="property" value="text"/> |
| </setup> |
| <body> |
| <SetProperty target="myCustomPhN.ti1" propertyName="text" value="984544926" waitEvent="updateComplete" waitTarget="myCustomPhN.ti1"/> |
| <DispatchKeyEvent keys="[TAB, TAB]"/> |
| <AssertEvent target="myCustomPhN.myPhN" eventName="invalid" eventClass="mx.events::ValidationResultEvent" /> |
| <AssertNoEvent target="myCustomPhN.myPhN" eventName="valid" /> |
| <DispatchMouseEvent target="myCustomPhN.ti1" type="mouseOver" localX="10" localY="10" waitEvent="toolTipShown" waitTarget="myCustomPhN.ti1"/> |
| <WaitForEffectsToEnd /> |
| <CompareBitmap target="" url="../Properties/baselines/wrongLengthError.png" timeout="2000" /> |
| </body> |
| </TestCase> |
| </testCases> |
| </UnitTester> |