toolkit/content/tests/chrome/test_bug365773.xul

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:63570cb1d3ae
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 https://bugzilla.mozilla.org/show_bug.cgi?id=365773
6 -->
7 <window title="Mozilla Bug 365773"
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9
10 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
11
12 <body xmlns="http://www.w3.org/1999/xhtml">
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=365773">Mozilla Bug 365773</a>
14 <p id="display">
15 <radiogroup id="group" collapsed="true" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
16 <radio id="item" label="Item"/>
17 </radiogroup>
18 </p>
19 <div id="content" style="display: none">
20 </div>
21 <pre id="test">
22 </pre>
23 </body>
24
25 <script class="testbody" type="application/javascript">
26 <![CDATA[
27
28 /** Test for Bug 365773 **/
29
30 function selectItem(item, isIndex, testName) {
31 var exception = null;
32 try {
33 if (isIndex)
34 document.getElementById("group").selectedIndex = item;
35 else
36 document.getElementById("group").selectedItem = item;
37 }
38 catch(e) {
39 exception = e;
40 }
41
42 ok(exception == null, testName);
43 }
44
45 SimpleTest.waitForExplicitFinish();
46
47 window.onload = function runTests() {
48 var item = document.getElementById("item");
49
50 selectItem(item, false, "Radio button selected with selectedItem (not focused)");
51 selectItem(null, false, "Radio button deselected with selectedItem (not focused)");
52 selectItem(0, true, "Radio button selected with selectedIndex (not focused)");
53 selectItem(-1, true, "Radio button deselected with selectedIndex (not focused)");
54
55 document.getElementById("group").focus();
56
57 selectItem(item, false, "Radio button selected with selectedItem (focused)");
58 selectItem(null, false, "Radio button deselected with selectedItem (focused)");
59 selectItem(0, true, "Radio button selected with selectedIndex (focused)");
60 selectItem(-1, true, "Radio button deselected with selectedIndex (focused)");
61
62 SimpleTest.finish();
63 };
64 ]]>
65 </script>
66
67 </window>

mercurial