blob: 912edbe1a7d3e940273ef212bd01ad32be6b8457 [file] [log] [blame]
<?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="gumbo/components/ButtonBar/Methods/" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="ButtonBarApp1.mxml">
<!-- this set of lines form a template 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 Assets.*;
import spark.components.*;
import spark.events.ElementExistenceEvent;
public var theToggleButton:ToggleButton;
]]>
</mx:Script>
<testCases>
<!--
==================================================================
dataGroup_itemRemoveHandler(event:ElementExistenceEvent):void
- We can't verify that the event listener was removed, because
an ToggleButton has a click anyway. The IEventDispatcher API
does not provide a way to ensure that the specific listener which
we added is no longer present, and since ButtonBar registered
a private method to be called on click, we can't override it
and check to see if it got called.
So re-add the button as a child for the app and click on it.
If the code is working right, then the ButtonBar won't respond.
If the code is working wrong, then the ButtonBar should err
when clicking this button because it is not in the bar anymore.
==================================================================
-->
<TestCase testID="dataGroup_itemRemoveHandler_test1" keywords="[ButtonBar,dataGroup_itemRemoveHandler]" description="When an item is removed, its click handler should be also." >
<setup>
<ResetComponent target="bb1" className="spark.components::ButtonBar" waitEvent="updateComplete" />
<RunCode code="application.setDataProvider(application.bb1, 1)" waitTarget="bb1" waitEvent="updateComplete" />
</setup>
<body>
<RunCode code="theToggleButton = application.bb1.dataGroup.getElementAt(2)" />
<RunCode code="application.bb1.dataProvider.removeItemAt(2)" waitTarget="bb1" waitEvent="updateComplete" />
<RunCode code="application.addElement(theToggleButton)" />
<DispatchMouseClickEvent target="script:theToggleButton" />
<AssertPropertyValue target="bb1" propertyName="selectedIndex" value="-1" />
</body>
</TestCase>
</testCases>
</UnitTester>