tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_radio_in_label.html (1638B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=229925
      5 -->
      6 <head>
      7  <title>Test for Bug 229925</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <script src="/tests/SimpleTest/EventUtils.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     11 </head>
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=229925">Mozilla Bug 229925</a>
     14 <p id="display"></p>
     15 <form>
     16  <label>
     17    <span id="s1">LABEL</span>
     18    <input type="radio" name="rdo" value="1" id="r1" onmousedown="document.body.appendChild(document.createTextNode('down'));">
     19    <input type="radio" name="rdo" value="2" id="r2" checked="checked">
     20  </label>
     21 </form>
     22 <script class="testbody" type="text/javascript">
     23 
     24 /** Test for Bug 229925 */
     25 SimpleTest.waitForExplicitFinish();
     26 var r1 = document.getElementById("r1");
     27 var r2 = document.getElementById("r2");
     28 var s1 = document.getElementById("s1");
     29 startTest();
     30 function startTest() {
     31  r1.click();
     32  ok(r1.checked,
     33     "The first radio input element should be checked by clicking the element");
     34  r2.click();
     35  ok(r2.checked,
     36     "The second radio input element should be checked by clicking the element");
     37  s1.click();
     38  ok(r1.checked,
     39     "The first radio input element should be checked by clicking other element");
     40 
     41  r1.focus();
     42  synthesizeKey("KEY_ArrowLeft");
     43  ok(r2.checked,
     44     "The second radio input element should be checked by key");
     45  synthesizeKey("KEY_ArrowLeft");
     46  ok(r1.checked,
     47     "The first radio input element should be checked by key");
     48  SimpleTest.finish();
     49 }
     50 </script>
     51 </pre>
     52 </body>
     53 </html>