toolkit/content/tests/chrome/test_bug365773.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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 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">
    10   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>      
    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>
    25 <script class="testbody" type="application/javascript">
    26 <![CDATA[
    28 /** Test for Bug 365773 **/
    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   }
    42   ok(exception == null, testName);
    43 }
    45 SimpleTest.waitForExplicitFinish();
    47 window.onload = function runTests() {
    48   var item = document.getElementById("item");
    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)");
    55   document.getElementById("group").focus();
    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)");
    62   SimpleTest.finish();
    63 };
    64 ]]>
    65 </script>
    67 </window>

mercurial