| <?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 |
| xmlns:fx="http://ns.adobe.com/mxml/2009" |
| xmlns:mx="library://ns.adobe.com/flex/mx" |
| xmlns:s="library://ns.adobe.com/flex/spark" |
| xmlns="*" |
| testDir="mobile/components/ToggleSwitch/events/" |
| testSWF="ToggleSwitchEvents.mxml"> |
| |
| <fx:Script><![CDATA[ public static function init(o:DisplayObject):void { } ]]></fx:Script> |
| <fx:Metadata><![CDATA[ [Mixin] ]]></fx:Metadata> |
| |
| <testCases> |
| |
| |
| <!-- mouseDown --> |
| |
| <TestCase testID="events_mouseDown" keywords="[ToggleSwitch, mobile, mouseDown, event]" description="mouseDown not triggering selection change"> |
| <setup> |
| <ResetComponent target="eventsRoot" className="comps.EventsRoot" waitEvent="updateComplete" /> |
| </setup> |
| <body> |
| <DispatchMouseEvent target="eventsRoot.target1" type="rollOver" localX="47" localY="20" waitEvent="rollOver" /> |
| <DispatchMouseEvent target="eventsRoot.target1" type="mouseMove" localX="47" localY="20" waitEvent="mouseMove" /> |
| <DispatchMouseEvent target="eventsRoot.target1" type="mouseDown" localX="47" localY="20" waitEvent="mouseDown" /> |
| <AssertEvent target="eventsRoot.target1" eventName="mouseDown" eventClass="flash.events::MouseEvent" numExpectedEvents="1" /> |
| <AssertPropertyValue target="eventsRoot.target1" propertyName="selected" value="false" /> |
| </body> |
| </TestCase> |
| |
| <!-- click: click event doesn't update selected property. --> |
| |
| <TestCase testID="click_dispatch" keywords="[ToggleSwitch, mobile, click, event]" description="Test ToggleSwitch click event dispatch"> |
| <setup> |
| <ResetComponent target="eventsRoot" className="comps.EventsRoot" waitEvent="updateComplete" /> |
| </setup> |
| <body> |
| <DispatchMouseEvent target="eventsRoot.target1" type="click" localX="47" localY="20" /> |
| <AssertEvent target="eventsRoot.target1" eventName="click" eventClass="flash.events::MouseEvent" numExpectedEvents="1" /> |
| <AssertPropertyValue target="eventsRoot.target1" propertyName="selected" value="false" /> |
| |
| </body> |
| </TestCase> |
| |
| <!-- change --> |
| |
| <TestCase testID="change_dispatch" keywords="[ToggleSwitch, mobile, change, event]" description="Test change event is dispatched when clicking ToggleSwitch"> |
| <setup> |
| <ResetComponent target="eventsRoot" className="comps.EventsRoot" waitEvent="updateComplete" /> |
| </setup> |
| <body> |
| <DispatchMouseEvent target="eventsRoot.target1" type="mouseDown" localX="47" localY="20" waitEvent="mouseDown" /> |
| <DispatchMouseEvent target="eventsRoot.target1" type="mouseUp" localX="47" localY="20" waitEvent="mouseUp" /> |
| <WaitForEffectsToEnd waitTarget="eventsRoot.target1" /> |
| <AssertEvent target="eventsRoot.target1" eventName="change" eventClass="flash.events::Event" numExpectedEvents="1" /> |
| <AssertPropertyValue target="eventsRoot.target1" propertyName="selected" value="true" /> |
| </body> |
| </TestCase> |
| |
| |
| |
| |
| </testCases> |
| </UnitTester> |