tor-browser

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

test_bug471319.html (2526B)


      1 <!DOCTYPE HTML>
      2 <!-- This Source Code Form is subject to the terms of the Mozilla Public
      3   - License, v. 2.0. If a copy of the MPL was not distributed with this
      4   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
      5 <html>
      6 <!--
      7 https://bugzilla.mozilla.org/show_bug.cgi?id=471319
      8 -->
      9 
     10 <head>
     11  <title>Test for Bug 471319</title>
     12  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     13  <link rel="stylesheet" href="/tests/SimpleTest/test.css">
     14 </head>
     15 
     16 <body onload="doTest();">
     17  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=471319">Mozilla Bug 471319</a>
     18  <p id="display"></p>
     19  <div id="content" style="display: none">
     20  </div>
     21 
     22  <pre id="test">
     23    <script type="application/javascript">
     24 
     25      /** Test for Bug 471319 */
     26 
     27      SimpleTest.waitForExplicitFinish();
     28 
     29      function doTest() {
     30        let t1 = SpecialPowers.wrap($("t1"));
     31 
     32        // Test 1: Undo on an empty editor - the editor should not forget about
     33        // the padding <br> element for empty editor.
     34        let t1Editor = t1.editor;
     35 
     36        // Did the editor recognize the new padding <br> element?
     37        t1Editor.undo();
     38        ok(!t1.value, "<br> still recognized as padding on undo");
     39 
     40 
     41        // Test 2: Redo on an empty editor - the editor should not forget about
     42        // the padding <br> element for empty editor.
     43        let t2 = SpecialPowers.wrap($("t2"));
     44        let t2Editor = t2.editor;
     45 
     46        // Did the editor recognize the new padding <br> element?
     47        t2Editor.redo();
     48        ok(!t2.value, "<br> still recognized as padding on redo");
     49 
     50 
     51        // Test 3: Undoing a batched transaction where both end points of the
     52        // transaction are the padding <br> element for empty editor - the
     53        // <br> element should still be recognized as padding.
     54        t1Editor.beginTransaction();
     55        t1.value = "mozilla";
     56        t1.value = "";
     57        t1Editor.endTransaction();
     58        t1Editor.undo();
     59        ok(!t1.value,
     60           "recreated <br> from undo transaction recognized as padding");
     61 
     62 
     63        // Test 4: Redoing a batched transaction where both end points of the
     64        // transaction are the padding <br> element for empty editor - the
     65        // <br> element should still be recognized padding.
     66        t1Editor.redo();
     67        ok(!t1.value,
     68           "recreated <br> from redo transaction recognized as padding");
     69        SimpleTest.finish();
     70     }
     71   </script>
     72  </pre>
     73 
     74  <input type="text" id="t1" />
     75  <input type="text" id="t2" />
     76 </body>
     77 </html>