Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
4 <!--
5 XUL Widget Test for radio buttons
6 -->
7 <window title="Radio Buttons" width="500" height="600"
8 onload="setTimeout(test_radio, 0);"
9 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
10 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
11 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
12 <script type="application/javascript" src="xul_selectcontrol.js"/>
14 <radiogroup id="radiogroup"/>
16 <radiogroup id="radiogroup-initwithvalue" value="two">
17 <radio label="One" value="one"/>
18 <radio label="Two" value="two"/>
19 <radio label="Three" value="three"/>
20 </radiogroup>
21 <radiogroup id="radiogroup-initwithselected" value="two">
22 <radio id="one" label="One" value="one" accesskey="o"/>
23 <radio id="two" label="Two" value="two" accesskey="t"/>
24 <radio label="Three" value="three" selected="true"/>
25 </radiogroup>
27 <!-- test results are displayed in the html:body -->
28 <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
30 <!-- test code goes here -->
31 <script type="application/javascript"><![CDATA[
33 SimpleTest.waitForExplicitFinish();
35 function test_radio()
36 {
37 var element = document.getElementById("radiogroup");
38 test_nsIDOMXULSelectControlElement(element, "radio", null);
39 test_nsIDOMXULSelectControlElement_UI(element, null);
41 window.blur();
43 var accessKeyDetails = (navigator.platform.indexOf("Mac") >= 0) ?
44 { altKey : true, ctrlKey : true } :
45 { altKey : true, shiftKey: true };
46 synthesizeKey("t", accessKeyDetails);
48 var radiogroup = $("radiogroup-initwithselected");
49 is(document.activeElement, radiogroup, "accesskey focuses radiogroup");
50 is(radiogroup.selectedItem, $("two"), "accesskey selects radio");
52 $("radiogroup-initwithvalue").focus();
54 $("one").disabled = true;
55 synthesizeKey("o", accessKeyDetails);
57 is(document.activeElement, $("radiogroup-initwithvalue"), "accesskey on disabled radio doesn't focus");
58 is(radiogroup.selectedItem, $("two"), "accesskey on disabled radio doesn't change selection");
60 SimpleTest.finish();
61 }
63 ]]>
64 </script>
66 </window>