tor-browser

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

test_bug1352799.html (2049B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1352799
      5 -->
      6 <head>
      7  <title>Test for Bug 1352799</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=1352799">Mozilla Bug 1352799</a>
     14 <p id="display"></p>
     15 <div id="content">
     16 <div id="input-container" style="display: none;">
     17 <input id="input" maxlength="1">
     18 </div>
     19 </div>
     20 <pre id="test">
     21 <script type="application/javascript">
     22 
     23 /** Test for Bug 1352799 */
     24 SimpleTest.waitForExplicitFinish();
     25 SimpleTest.waitForFocus(() => {
     26  var input = document.getElementById("input");
     27 
     28  var inputcontainer = document.getElementById("input-container");
     29  input.setAttribute("maxlength", 2);
     30  inputcontainer.style.display = "block";
     31 
     32  input.focus();
     33 
     34  sendString("123");
     35 
     36  is(input.value, "12", "value should be 12 with maxlength = 2");
     37 
     38  input.value = "";
     39  inputcontainer.style.display = "none";
     40 
     41  window.setTimeout(() => {
     42    input.setAttribute("maxlength", 4);
     43    inputcontainer.style.display = "block";
     44 
     45    input.focus();
     46 
     47    sendString("45678");
     48 
     49    is(input.value, "4567", "value should be 4567 with maxlength = 4");
     50 
     51    inputcontainer.style.display = "none";
     52 
     53    window.setTimeout(() => {
     54      input.setAttribute("maxlength", 2);
     55      inputcontainer.style.display = "block";
     56 
     57      input.focus();
     58 
     59      sendString("12");
     60 
     61      todo_is(input.value, "45", "value should be 45 with maxlength = 2");
     62 
     63      input.value = "";
     64      inputcontainer.style.display = "none";
     65 
     66      window.setTimeout(() => {
     67        input.removeAttribute("maxlength");
     68        inputcontainer.style.display = "block";
     69 
     70        input.focus();
     71 
     72        sendString("12345678");
     73 
     74        is(input.value, "12345678", "value should be 12345678 without maxlength");
     75 
     76        SimpleTest.finish();
     77      }, 0);
     78    }, 0);
     79  }, 0);
     80 });
     81 </script>
     82 </pre>
     83 </body>
     84 </html>