editor/libeditor/html/tests/test_bug455992.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 <!DOCTYPE HTML>
     2 <html><head>
     3 <title>Test for bug 455992</title>
     4 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     5 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     8 <script class="testbody" type="application/javascript">
     9 function runTest() {
    11   function select(id) {
    12     var e = document.getElementById(id);
    13     e.focus();
    14     return e;
    15   }
    17   function setupIframe(id) {
    18     var e = document.getElementById(id);
    19     var doc = e.contentDocument;
    20     doc.body.innerHTML = String.fromCharCode(10)+'<span id="' + id + '_span" style="border:1px solid blue" contenteditable="true">X</span>'+String.fromCharCode(10);
    21     e = doc.getElementById(id + "_span");
    22     e.focus();
    23     return e;
    24   }
    26   function test_begin_bs(e) {
    27     const msg = "BACKSPACE at beginning of contenteditable inline element";
    28     var before = e.parentNode.childNodes[0].nodeValue;
    29     sendKey("back_space");
    30     is(e.parentNode.childNodes[0].nodeValue, before, msg + " with id=" + e.id);
    31     is(e.innerHTML, "X", msg + " with id=" + e.id);
    32   }
    34   function test_begin_space(e) {
    35     const msg = "SPACE at beginning of contenteditable inline element";
    36     var before = e.parentNode.childNodes[0].nodeValue;
    37     sendChar(" ");
    38     is(e.parentNode.childNodes[0].nodeValue, before, msg + " with id=" + e.id);
    39     is(e.innerHTML, "&nbsp;X", msg + " with id=" + e.id);
    40   }
    42   function test_end_delete(e) {
    43     const msg = "DEL at end of contenteditable inline element";
    44     var before = e.parentNode.childNodes[2].nodeValue;
    45     sendKey("right");
    46     sendKey("delete");
    47     is(e.parentNode.childNodes[2].nodeValue, before, msg + " with id=" + e.id);
    48     is(e.innerHTML, "X", msg + " with id=" + e.id);
    49   }
    51   function test_end_space(e) {
    52     const msg = "SPACE at end of contenteditable inline element";
    53     var before = e.parentNode.childNodes[2].nodeValue;
    54     sendKey("right");
    55     sendChar(" ");
    56     is(e.parentNode.childNodes[2].nodeValue, before, msg + " with id=" + e.id);
    57     is(e.innerHTML, "X" + (e.tagName=="SPAN" ? "&nbsp;" : " <br>"), msg + " with id=" + e.id);
    58   }
    60   test_begin_bs(select("t1"));
    61   test_begin_space(select("t2"));
    62   test_end_delete(select("t3"));
    63   test_end_space(select("t4"));
    64   test_end_space(select("t5"));
    66   test_begin_bs(setupIframe('i1'));
    67   test_begin_space(setupIframe('i2'));
    68   test_end_delete(setupIframe('i3'));
    69   test_end_space(setupIframe('i4'));
    71   SimpleTest.finish();
    72 }
    74 SimpleTest.waitForExplicitFinish();
    75 addLoadEvent(runTest);
    76 </script>
    77 </head>
    78 <body>
    79 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=455992">Mozilla Bug 455992</a>
    80 <p id="display"></p>
    82 <pre id="test">
    83 </pre>
    85 <div> <span id="t1" style="border:1px solid blue" contenteditable="true">X</span> Y</div>
    86 <div> <span id="t2" style="border:1px solid blue" contenteditable="true">X</span> Y</div>
    87 <div> <span id="t3" style="border:1px solid blue" contenteditable="true">X</span> Y</div>
    88 <div> <span id="t4" style="border:1px solid blue" contenteditable="true">X</span> Y</div>
    89 <div> <div id="t5" style="border:1px solid blue" contenteditable="true">X</div> Y</div>
    91 <iframe id="i1" width="200" height="100" src="about:blank"></iframe><br>
    92 <iframe id="i2" width="200" height="100" src="about:blank"></iframe><br>
    93 <iframe id="i3" width="200" height="100" src="about:blank"></iframe><br>
    94 <iframe id="i4" width="200" height="100" src="about:blank"></iframe><br>
    96 </body>
    97 </html>

mercurial