tor-browser

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

test_bug346043.html (2114B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=346043
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 346043</title>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     10  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     11  <script src="/tests/SimpleTest/EventUtils.js"></script>
     12  <script type="application/javascript">
     13    /** Test for Bug 346043 */
     14    function test(select, index, useEscape) {
     15      select.selectedIndex = index;
     16      is(select.selectedIndex, index, "Selected index is broken");
     17 
     18      // Open the select dropdown.
     19      //
     20      // Using Alt+Down (instead of a click) seems necessary to make subsequent
     21      // mouse events work with the dropdown itself, instead of the window below
     22      // it.
     23      select.focus();
     24      synthesizeKey("KEY_ArrowDown", {altKey: true});
     25 
     26      var options = select.getElementsByTagName("option");
     27      synthesizeMouseAtCenter(options[1],
     28                              {type: "mousemove", clickCount: 0});
     29 
     30      // Close the select dropdown.
     31      if (useEscape)
     32        synthesizeKey("KEY_Escape");  // Tests a different code path.
     33      select.blur();
     34      is(select.selectedIndex, index, "Selected index shouldn't change");
     35    }
     36 
     37    SimpleTest.waitForExplicitFinish();
     38    SimpleTest.waitForFocus(function() {
     39      test(document.getElementById("test-unselected"), -1, true);
     40      test(document.getElementById("test-unselected"), -1, false);
     41      test(document.getElementById("test-disabled"), 0, true);
     42      test(document.getElementById("test-disabled"), 0, false);
     43      SimpleTest.finish();
     44    });
     45  </script>
     46 </head>
     47 <body>
     48  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=346043">Mozilla Bug 346043</a>
     49  <p id="display"></p>
     50  <div id="content">
     51    <select id="test-unselected">
     52      <option>A</option>
     53      <option>B</option>
     54      <option>C</option>
     55    </select>
     56 
     57    <select id="test-disabled">
     58      <option disabled>A</option>
     59      <option>B</option>
     60      <option>C</option>
     61    </select>
     62  </div>
     63  <pre id="test"></pre>
     64 </body>
     65 </html>