Test for bug 488752 r=enn
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Mon, 04 May 2009 21:16:05 +0100
changeset 27979 37fd71682657961b26f4b5860c4f495fd05857a6
parent 27978 46a2cbd99142e98d995417ab9c448c27a5dd3985
child 27980 9c7d85c8390c3a29cd63891a41a08fcc92a2b9db
push id6820
push userneil@parkwaycc.co.uk
push dateMon, 04 May 2009 20:16:23 +0000
treeherdermozilla-central@37fd71682657 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenn
bugs488752
milestone1.9.2a1pre
Test for bug 488752 r=enn
toolkit/content/tests/widgets/test_menulist_keynav.xul
--- a/toolkit/content/tests/widgets/test_menulist_keynav.xul
+++ b/toolkit/content/tests/widgets/test_menulist_keynav.xul
@@ -9,17 +9,17 @@
 
   <title>Menulist Key Navigation Tests</title>
   <script type="application/javascript" src="/MochiKit/packed.js"></script>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>      
   <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>      
 
 <button id="button1" label="One"/>
 <menulist id="list">
-  <menupopup>
+  <menupopup id="popup" onpopupshowing="return false;">
     <menuitem id="i1" label="One"/>
     <menuitem id="i2" label="Two"/>
     <menuitem id="i2b" disabled="true" label="Two and a Half"/>
     <menuitem id="i3" label="Three"/>
     <menuitem id="i4" label="Four"/>
   </menupopup>
 </menulist>
 <button id="button2" label="Two"/>
@@ -41,16 +41,22 @@ function runTests()
     keyCheck(list, "VK_DOWN", 2, "cursor down");
     keyCheck(list, "VK_DOWN", iswin ? "2b" : 3, "cursor down skip disabled");
     keyCheck(list, "VK_UP", 2, "cursor up skip disabled");
     keyCheck(list, "VK_UP", 1, "cursor up");
     keyCheck(list, "VK_UP", 4, "cursor up wrap");
     keyCheck(list, "VK_DOWN", 1, "cursor down wrap");
   }
 
+  // check that attempting to open the menulist does not change the selection
+  synthesizeKey("VK_DOWN", { altKey: navigator.platform.indexOf("Mac") == -1 });
+  is(list.selectedItem, $("i1"), "open menulist down selectedItem");
+  synthesizeKey("VK_UP", { altKey: navigator.platform.indexOf("Mac") == -1 });
+  is(list.selectedItem, $("i1"), "open menulist up selectedItem");
+
   synthesizeKey("G", { });
   is(list.selectedItem, $("i1"), "letter pressed not found selectedItem");
 
   keyCheck(list, "T", 2, "letter pressed");
   keyCheck(list, "T", 2, "letter pressed");
   setTimeout(pressedAgain, 1200); 
 }