toolkit/content/tests/chrome/test_radio.xul

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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

mercurial