tor-browser

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

test_option_selected_state.html (1873B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=942648
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 942648</title>
      9  <script src="/tests/SimpleTest/SimpleTest.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=942648">Mozilla Bug 942648</a>
     14 <p id="display"></p>
     15 <div id="content" style="display: none">
     16 
     17 </div>
     18 <pre id="test">
     19  <select>
     20    <option value="1">1</option>
     21    <option id="e1" value="2">2</option>
     22  </select>
     23  <select>
     24    <option value="1">1</option>
     25    <option id="e2" selected value="2">2</option>
     26  </select>
     27  <select>
     28    <option value="1">1</option>
     29    <option id="e3" selected="" value="2">2</option>
     30  </select>
     31  <select>
     32    <option value="1">1</option>
     33    <option id="e4" selected="selected" value="2">2</option>
     34  </select>
     35 </pre>
     36  <script type="application/javascript">
     37 
     38  /** Test for Bug 942648 */
     39 SimpleTest.waitForExplicitFinish();
     40  window.onload = function() {
     41    var e1 = document.getElementById('e1');
     42    var e2 = document.getElementById('e2');
     43    var e3 = document.getElementById('e3');
     44    var e4 = document.getElementById('e4');
     45    ok(!e1.selected, "e1 should not be selected");
     46    ok(e2.selected, "e2 should be selected");
     47    ok(e3.selected, "e3 should be selected");
     48    ok(e4.selected, "e4 should be selected");
     49    e1.setAttribute('selected', 'selected');
     50    e2.setAttribute('selected', 'selected');
     51    e3.setAttribute('selected', 'selected');
     52    e4.setAttribute('selected', 'selected');
     53    ok(e1.selected, "e1 should now be selected");
     54    ok(e2.selected, "e2 should still be selected");
     55    ok(e3.selected, "e3 should still be selected");
     56    ok(e4.selected, "e4 should still be selected");
     57    SimpleTest.finish();
     58  };
     59  </script>
     60 </body>
     61 </html>