gecko/toolkit/content/tests/chrome/test_panelfrommenu.xul

119 lines
3.8 KiB
Plaintext
Raw Normal View History

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
Bug 508710 - moving toolkit/content/tests/widgets/*.xul from mochitest to mochitest-chrome. r=enn, a=test-only --HG-- rename : toolkit/content/tests/widgets/frame_popupremoving_frame.xul => toolkit/content/tests/chrome/frame_popupremoving_frame.xul rename : toolkit/content/tests/widgets/popup_childframe_node.xul => toolkit/content/tests/chrome/popup_childframe_node.xul rename : toolkit/content/tests/widgets/popup_trigger.js => toolkit/content/tests/chrome/popup_trigger.js rename : toolkit/content/tests/widgets/test_bug360220.xul => toolkit/content/tests/chrome/test_bug360220.xul rename : toolkit/content/tests/widgets/test_bug365773.xul => toolkit/content/tests/chrome/test_bug365773.xul rename : toolkit/content/tests/widgets/test_bug382990.xul => toolkit/content/tests/chrome/test_bug382990.xul rename : toolkit/content/tests/widgets/test_bug457632.xul => toolkit/content/tests/chrome/test_bug457632.xul rename : toolkit/content/tests/widgets/test_bug460942.xul => toolkit/content/tests/chrome/test_bug460942.xul rename : toolkit/content/tests/widgets/test_bug509732.xul => toolkit/content/tests/chrome/test_bug509732.xul rename : toolkit/content/tests/widgets/test_bug554279.xul => toolkit/content/tests/chrome/test_bug554279.xul rename : toolkit/content/tests/widgets/test_bug557987.xul => toolkit/content/tests/chrome/test_bug557987.xul rename : toolkit/content/tests/widgets/test_bug562554.xul => toolkit/content/tests/chrome/test_bug562554.xul rename : toolkit/content/tests/widgets/test_button.xul => toolkit/content/tests/chrome/test_button.xul rename : toolkit/content/tests/widgets/test_closemenu_attribute.xul => toolkit/content/tests/chrome/test_closemenu_attribute.xul rename : toolkit/content/tests/widgets/test_colorpicker_popup.xul => toolkit/content/tests/chrome/test_colorpicker_popup.xul rename : toolkit/content/tests/widgets/test_contextmenu_list.xul => toolkit/content/tests/chrome/test_contextmenu_list.xul rename : toolkit/content/tests/widgets/test_focus_anons.xul => toolkit/content/tests/chrome/test_focus_anons.xul rename : toolkit/content/tests/widgets/test_hiddenitems.xul => toolkit/content/tests/chrome/test_hiddenitems.xul rename : toolkit/content/tests/widgets/test_hiddenpaging.xul => toolkit/content/tests/chrome/test_hiddenpaging.xul rename : toolkit/content/tests/widgets/test_menu.xul => toolkit/content/tests/chrome/test_menu.xul rename : toolkit/content/tests/widgets/test_menu_hide.xul => toolkit/content/tests/chrome/test_menu_hide.xul rename : toolkit/content/tests/widgets/test_menuitem_blink.xul => toolkit/content/tests/chrome/test_menuitem_blink.xul rename : toolkit/content/tests/widgets/test_menulist.xul => toolkit/content/tests/chrome/test_menulist.xul rename : toolkit/content/tests/widgets/test_menulist_keynav.xul => toolkit/content/tests/chrome/test_menulist_keynav.xul rename : toolkit/content/tests/widgets/test_notificationbox.xul => toolkit/content/tests/chrome/test_notificationbox.xul rename : toolkit/content/tests/widgets/test_panelfrommenu.xul => toolkit/content/tests/chrome/test_panelfrommenu.xul rename : toolkit/content/tests/widgets/test_popup_attribute.xul => toolkit/content/tests/chrome/test_popup_attribute.xul rename : toolkit/content/tests/widgets/test_popup_button.xul => toolkit/content/tests/chrome/test_popup_button.xul rename : toolkit/content/tests/widgets/test_popup_coords.xul => toolkit/content/tests/chrome/test_popup_coords.xul rename : toolkit/content/tests/widgets/test_popup_keys.xul => toolkit/content/tests/chrome/test_popup_keys.xul rename : toolkit/content/tests/widgets/test_popup_preventdefault.xul => toolkit/content/tests/chrome/test_popup_preventdefault.xul rename : toolkit/content/tests/widgets/test_popup_recreate.xul => toolkit/content/tests/chrome/test_popup_recreate.xul rename : toolkit/content/tests/widgets/test_popup_scaled.xul => toolkit/content/tests/chrome/test_popup_scaled.xul rename : toolkit/content/tests/widgets/test_popup_tree.xul => toolkit/content/tests/chrome/test_popup_tree.xul rename : toolkit/content/tests/widgets/test_popuphidden.xul => toolkit/content/tests/chrome/test_popuphidden.xul rename : toolkit/content/tests/widgets/test_popupincontent.xul => toolkit/content/tests/chrome/test_popupincontent.xul rename : toolkit/content/tests/widgets/test_popupremoving.xul => toolkit/content/tests/chrome/test_popupremoving.xul rename : toolkit/content/tests/widgets/test_popupremoving_frame.xul => toolkit/content/tests/chrome/test_popupremoving_frame.xul rename : toolkit/content/tests/widgets/test_position.xul => toolkit/content/tests/chrome/test_position.xul rename : toolkit/content/tests/widgets/test_progressmeter.xul => toolkit/content/tests/chrome/test_progressmeter.xul rename : toolkit/content/tests/widgets/test_props.xul => toolkit/content/tests/chrome/test_props.xul rename : toolkit/content/tests/widgets/test_radio.xul => toolkit/content/tests/chrome/test_radio.xul rename : toolkit/content/tests/widgets/test_richlist_direction.xul => toolkit/content/tests/chrome/test_richlist_direction.xul rename : toolkit/content/tests/widgets/test_scale.xul => toolkit/content/tests/chrome/test_scale.xul rename : toolkit/content/tests/widgets/test_scrollbar.xul => toolkit/content/tests/chrome/test_scrollbar.xul rename : toolkit/content/tests/widgets/test_sorttemplate.xul => toolkit/content/tests/chrome/test_sorttemplate.xul rename : toolkit/content/tests/widgets/test_statusbar.xul => toolkit/content/tests/chrome/test_statusbar.xul rename : toolkit/content/tests/widgets/test_tabbox.xul => toolkit/content/tests/chrome/test_tabbox.xul rename : toolkit/content/tests/widgets/test_tabindex.xul => toolkit/content/tests/chrome/test_tabindex.xul rename : toolkit/content/tests/widgets/test_textbox_emptytext.xul => toolkit/content/tests/chrome/test_textbox_emptytext.xul rename : toolkit/content/tests/widgets/test_textbox_number.xul => toolkit/content/tests/chrome/test_textbox_number.xul rename : toolkit/content/tests/widgets/test_textbox_search.xul => toolkit/content/tests/chrome/test_textbox_search.xul rename : toolkit/content/tests/widgets/test_timepicker.xul => toolkit/content/tests/chrome/test_timepicker.xul rename : toolkit/content/tests/widgets/test_toolbar.xul => toolkit/content/tests/chrome/test_toolbar.xul rename : toolkit/content/tests/widgets/test_tooltip.xul => toolkit/content/tests/chrome/test_tooltip.xul rename : toolkit/content/tests/widgets/test_tooltip_noautohide.xul => toolkit/content/tests/chrome/test_tooltip_noautohide.xul rename : toolkit/content/tests/widgets/test_tree.xul => toolkit/content/tests/chrome/test_tree.xul rename : toolkit/content/tests/widgets/test_tree_single.xul => toolkit/content/tests/chrome/test_tree_single.xul rename : toolkit/content/tests/widgets/test_tree_view.xul => toolkit/content/tests/chrome/test_tree_view.xul rename : toolkit/content/tests/widgets/window_popup_attribute.xul => toolkit/content/tests/chrome/window_popup_attribute.xul rename : toolkit/content/tests/widgets/window_popup_button.xul => toolkit/content/tests/chrome/window_popup_button.xul rename : toolkit/content/tests/widgets/xul_selectcontrol.js => toolkit/content/tests/chrome/xul_selectcontrol.js
2011-06-24 09:39:13 -07:00
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Open panel from menuitem"
onload="setTimeout(runTests, 0);"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
Bug 508710 - moving toolkit/content/tests/widgets/*.xul from mochitest to mochitest-chrome. r=enn, a=test-only --HG-- rename : toolkit/content/tests/widgets/frame_popupremoving_frame.xul => toolkit/content/tests/chrome/frame_popupremoving_frame.xul rename : toolkit/content/tests/widgets/popup_childframe_node.xul => toolkit/content/tests/chrome/popup_childframe_node.xul rename : toolkit/content/tests/widgets/popup_trigger.js => toolkit/content/tests/chrome/popup_trigger.js rename : toolkit/content/tests/widgets/test_bug360220.xul => toolkit/content/tests/chrome/test_bug360220.xul rename : toolkit/content/tests/widgets/test_bug365773.xul => toolkit/content/tests/chrome/test_bug365773.xul rename : toolkit/content/tests/widgets/test_bug382990.xul => toolkit/content/tests/chrome/test_bug382990.xul rename : toolkit/content/tests/widgets/test_bug457632.xul => toolkit/content/tests/chrome/test_bug457632.xul rename : toolkit/content/tests/widgets/test_bug460942.xul => toolkit/content/tests/chrome/test_bug460942.xul rename : toolkit/content/tests/widgets/test_bug509732.xul => toolkit/content/tests/chrome/test_bug509732.xul rename : toolkit/content/tests/widgets/test_bug554279.xul => toolkit/content/tests/chrome/test_bug554279.xul rename : toolkit/content/tests/widgets/test_bug557987.xul => toolkit/content/tests/chrome/test_bug557987.xul rename : toolkit/content/tests/widgets/test_bug562554.xul => toolkit/content/tests/chrome/test_bug562554.xul rename : toolkit/content/tests/widgets/test_button.xul => toolkit/content/tests/chrome/test_button.xul rename : toolkit/content/tests/widgets/test_closemenu_attribute.xul => toolkit/content/tests/chrome/test_closemenu_attribute.xul rename : toolkit/content/tests/widgets/test_colorpicker_popup.xul => toolkit/content/tests/chrome/test_colorpicker_popup.xul rename : toolkit/content/tests/widgets/test_contextmenu_list.xul => toolkit/content/tests/chrome/test_contextmenu_list.xul rename : toolkit/content/tests/widgets/test_focus_anons.xul => toolkit/content/tests/chrome/test_focus_anons.xul rename : toolkit/content/tests/widgets/test_hiddenitems.xul => toolkit/content/tests/chrome/test_hiddenitems.xul rename : toolkit/content/tests/widgets/test_hiddenpaging.xul => toolkit/content/tests/chrome/test_hiddenpaging.xul rename : toolkit/content/tests/widgets/test_menu.xul => toolkit/content/tests/chrome/test_menu.xul rename : toolkit/content/tests/widgets/test_menu_hide.xul => toolkit/content/tests/chrome/test_menu_hide.xul rename : toolkit/content/tests/widgets/test_menuitem_blink.xul => toolkit/content/tests/chrome/test_menuitem_blink.xul rename : toolkit/content/tests/widgets/test_menulist.xul => toolkit/content/tests/chrome/test_menulist.xul rename : toolkit/content/tests/widgets/test_menulist_keynav.xul => toolkit/content/tests/chrome/test_menulist_keynav.xul rename : toolkit/content/tests/widgets/test_notificationbox.xul => toolkit/content/tests/chrome/test_notificationbox.xul rename : toolkit/content/tests/widgets/test_panelfrommenu.xul => toolkit/content/tests/chrome/test_panelfrommenu.xul rename : toolkit/content/tests/widgets/test_popup_attribute.xul => toolkit/content/tests/chrome/test_popup_attribute.xul rename : toolkit/content/tests/widgets/test_popup_button.xul => toolkit/content/tests/chrome/test_popup_button.xul rename : toolkit/content/tests/widgets/test_popup_coords.xul => toolkit/content/tests/chrome/test_popup_coords.xul rename : toolkit/content/tests/widgets/test_popup_keys.xul => toolkit/content/tests/chrome/test_popup_keys.xul rename : toolkit/content/tests/widgets/test_popup_preventdefault.xul => toolkit/content/tests/chrome/test_popup_preventdefault.xul rename : toolkit/content/tests/widgets/test_popup_recreate.xul => toolkit/content/tests/chrome/test_popup_recreate.xul rename : toolkit/content/tests/widgets/test_popup_scaled.xul => toolkit/content/tests/chrome/test_popup_scaled.xul rename : toolkit/content/tests/widgets/test_popup_tree.xul => toolkit/content/tests/chrome/test_popup_tree.xul rename : toolkit/content/tests/widgets/test_popuphidden.xul => toolkit/content/tests/chrome/test_popuphidden.xul rename : toolkit/content/tests/widgets/test_popupincontent.xul => toolkit/content/tests/chrome/test_popupincontent.xul rename : toolkit/content/tests/widgets/test_popupremoving.xul => toolkit/content/tests/chrome/test_popupremoving.xul rename : toolkit/content/tests/widgets/test_popupremoving_frame.xul => toolkit/content/tests/chrome/test_popupremoving_frame.xul rename : toolkit/content/tests/widgets/test_position.xul => toolkit/content/tests/chrome/test_position.xul rename : toolkit/content/tests/widgets/test_progressmeter.xul => toolkit/content/tests/chrome/test_progressmeter.xul rename : toolkit/content/tests/widgets/test_props.xul => toolkit/content/tests/chrome/test_props.xul rename : toolkit/content/tests/widgets/test_radio.xul => toolkit/content/tests/chrome/test_radio.xul rename : toolkit/content/tests/widgets/test_richlist_direction.xul => toolkit/content/tests/chrome/test_richlist_direction.xul rename : toolkit/content/tests/widgets/test_scale.xul => toolkit/content/tests/chrome/test_scale.xul rename : toolkit/content/tests/widgets/test_scrollbar.xul => toolkit/content/tests/chrome/test_scrollbar.xul rename : toolkit/content/tests/widgets/test_sorttemplate.xul => toolkit/content/tests/chrome/test_sorttemplate.xul rename : toolkit/content/tests/widgets/test_statusbar.xul => toolkit/content/tests/chrome/test_statusbar.xul rename : toolkit/content/tests/widgets/test_tabbox.xul => toolkit/content/tests/chrome/test_tabbox.xul rename : toolkit/content/tests/widgets/test_tabindex.xul => toolkit/content/tests/chrome/test_tabindex.xul rename : toolkit/content/tests/widgets/test_textbox_emptytext.xul => toolkit/content/tests/chrome/test_textbox_emptytext.xul rename : toolkit/content/tests/widgets/test_textbox_number.xul => toolkit/content/tests/chrome/test_textbox_number.xul rename : toolkit/content/tests/widgets/test_textbox_search.xul => toolkit/content/tests/chrome/test_textbox_search.xul rename : toolkit/content/tests/widgets/test_timepicker.xul => toolkit/content/tests/chrome/test_timepicker.xul rename : toolkit/content/tests/widgets/test_toolbar.xul => toolkit/content/tests/chrome/test_toolbar.xul rename : toolkit/content/tests/widgets/test_tooltip.xul => toolkit/content/tests/chrome/test_tooltip.xul rename : toolkit/content/tests/widgets/test_tooltip_noautohide.xul => toolkit/content/tests/chrome/test_tooltip_noautohide.xul rename : toolkit/content/tests/widgets/test_tree.xul => toolkit/content/tests/chrome/test_tree.xul rename : toolkit/content/tests/widgets/test_tree_single.xul => toolkit/content/tests/chrome/test_tree_single.xul rename : toolkit/content/tests/widgets/test_tree_view.xul => toolkit/content/tests/chrome/test_tree_view.xul rename : toolkit/content/tests/widgets/window_popup_attribute.xul => toolkit/content/tests/chrome/window_popup_attribute.xul rename : toolkit/content/tests/widgets/window_popup_button.xul => toolkit/content/tests/chrome/window_popup_button.xul rename : toolkit/content/tests/widgets/xul_selectcontrol.js => toolkit/content/tests/chrome/xul_selectcontrol.js
2011-06-24 09:39:13 -07:00
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<!--
This test does the following:
1. Opens the menu, causing the popupshown event to fire, which will call menuOpened.
2. Keyboard events are fired to cause the first item on the menu to be executed.
3. The command event handler for the first menuitem opens the panel.
4. As a menuitem was executed, the menu will roll up, hiding it.
5. The popuphidden event for the menu calls menuClosed which tests the popup states.
6. The panelOpened function tests the popup states again and hides the popup.
7. Once the panel's popuphidden event fires, tests are performed to see if
panels inside buttons and toolbarbuttons work. Each is opened and the closed.
-->
<menu id="menu" onpopupshown="menuOpened()" onpopuphidden="menuClosed();">
<menupopup>
<menuitem id="i1" label="One" oncommand="$('panel').openPopup($('menu'), 'after_start');"/>
<menuitem id="i2" label="Two"/>
</menupopup>
</menu>
<panel id="hiddenpanel" hidden="true"/>
<panel id="panel" onpopupshown="panelOpened()"
onpopuphidden="$('button').focus(); $('button').open = true">
<textbox/>
</panel>
<button id="button" type="panel" label="Button">
<panel onpopupshown="panelOnButtonOpened(this)"
onpopuphidden="$('tbutton').open = true;">
<button label="OK" oncommand="this.parentNode.parentNode.open = false"/>
</panel>
</button>
<toolbarbutton id="tbutton" type="panel" label="Toolbarbutton">
<panel onpopupshown="panelOnToolbarbuttonOpened(this)"
onpopuphidden="SimpleTest.finish()">
<textbox/>
</panel>
</toolbarbutton>
<script class="testbody" type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
function runTests()
{
is($("hiddenpanel").state, "closed", "hidden popup is closed");
var menu = $("menu");
menu.open = true;
}
function menuOpened()
{
synthesizeKey("VK_DOWN", { });
synthesizeKey("VK_RETURN", { });
}
function menuClosed()
{
// the panel will be open at this point, but the popupshown event
// still needs to fire
is($("panel").state, "showing", "panel is open after menu hide");
is($("menu").firstChild.state, "closed", "menu is closed after menu hide");
}
function panelOpened()
{
is($("panel").state, "open", "panel is open");
is($("menu").firstChild.state, "closed", "menu is closed");
$("panel").hidePopup();
}
function panelOnButtonOpened(panel)
{
is(panel.state, 'open', 'button panel is open');
is(document.activeElement, document.documentElement, "focus blurred on panel from button open");
synthesizeKey("VK_DOWN", { });
is(document.activeElement, document.documentElement, "focus not modified on cursor down from button");
panel.firstChild.doCommand()
}
function panelOnToolbarbuttonOpened(panel)
{
is(panel.state, 'open', 'toolbarbutton panel is open');
is(document.activeElement, document.documentElement, "focus blurred on panel from toolbarbutton open");
panel.firstChild.focus();
synthesizeKey("VK_DOWN", { });
is(document.activeElement, panel.firstChild.inputField, "focus not modified on cursor down from toolbarbutton");
panel.parentNode.open = false;
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<p id="display">
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</window>