tor-browser

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

test_bug595310.html (1701B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=595310
      5 -->
      6 <head>
      7  <title>Test for Bug 595310</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <script src="/tests/SimpleTest/WindowSnapshot.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=595310">Mozilla Bug 595310</a>
     14 <p id="display"></p>
     15 <div id="content">
     16  <input id='i' value="bar">
     17  <textarea id='t'>bar</textarea>
     18 </div>
     19 <pre id="test">
     20 <script type="application/javascript">
     21 
     22 /** Test for Bug 595310 */
     23 
     24 SimpleTest.waitForExplicitFinish();
     25 
     26 addLoadEvent(function() {
     27  // We want to compare to value="bar" and no placeholder shown.
     28  // That is what is currently showed.
     29  var s1 = snapshotWindow(window, false);
     30 
     31  var content = document.getElementById('content');
     32  var i = document.getElementById('i');
     33  var t = SpecialPowers.wrap(document.getElementById('t'));
     34  i.value = ""; i.placeholder = "foo";
     35  t.value = ""; t.placeholder = "foo";
     36 
     37  // Flushing.
     38  // Note: one call would have been enough actually but I didn't want to favour
     39  // one element... ;)
     40  i.getBoundingClientRect();
     41  t.getBoundingClientRect();
     42 
     43  function synthesizeDropText(aElement, aText)
     44  {
     45    SpecialPowers.wrap(aElement).editor.insertText(aText);
     46  }
     47 
     48  // We insert "bar" and we should only see "bar" now.
     49  synthesizeDropText(i, "bar");
     50  synthesizeDropText(t, "bar");
     51 
     52  var s2 = snapshotWindow(window, false);
     53 
     54  ok(compareSnapshots(s1, s2, true)[0],
     55     "When setting the value, the placeholder should disappear.");
     56 
     57  SimpleTest.finish();
     58 });
     59 
     60 
     61 </script>
     62 </pre>
     63 </body>
     64 </html>