tor-browser

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

test_bug1140105.html (1943B)


      1 <!DOCTYPE>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1140105
      5 -->
      6 <head>
      7  <title>Test for Bug 1140105</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" href="/tests/SimpleTest/test.css">
     10  <script src="/tests/SimpleTest/EventUtils.js"></script>
     11 </head>
     12 <body>
     13 <div id="display">
     14 </div>
     15 
     16 <div id="content" contenteditable><font face="Arial">1234567890</font></div>
     17 
     18 <pre id="test">
     19 </pre>
     20 
     21 <script class="testbody" type="application/javascript">
     22 
     23 /** Test for Bug 1140105 */
     24 SimpleTest.waitForExplicitFinish();
     25 SimpleTest.waitForFocus(function() {
     26  var div = document.getElementById("content");
     27  div.focus();
     28  synthesizeMouseAtCenter(div, {});
     29  synthesizeKey("KEY_ArrowLeft");
     30 
     31  var sel = window.getSelection();
     32  var selRange = sel.getRangeAt(0);
     33  is(selRange.endContainer.nodeName, "#text", "selection should be in text node");
     34  is(selRange.endOffset, 9, "offset should be 9");
     35 
     36  var firstHas = {};
     37  var anyHas = {};
     38  var allHas = {};
     39  var editor = getEditor();
     40 
     41  editor.getInlinePropertyWithAttrValue("font", "face", "Arial", firstHas, anyHas, allHas);
     42  is(firstHas.value, true, "Test for Arial: firstHas: true expected");
     43  is(anyHas.value, true, "Test for Arial: anyHas: true expected");
     44  is(allHas.value, true, "Test for Arial: allHas: true expected");
     45  editor.getInlinePropertyWithAttrValue("font", "face", "Courier", firstHas, anyHas, allHas);
     46  is(firstHas.value, false, "Test for Courier: firstHas: false expected");
     47  is(anyHas.value, false, "Test for Courier: anyHas: false expected");
     48  is(allHas.value, false, "Test for Courier: allHas: false expected");
     49 
     50  SimpleTest.finish();
     51 });
     52 
     53 function getEditor() {
     54  var Ci = SpecialPowers.Ci;
     55  var editingSession = SpecialPowers.wrap(window).docShell.editingSession;
     56  var editor = editingSession.getEditorForWindow(window);
     57  editor.QueryInterface(Ci.nsIHTMLEditor);
     58  return editor;
     59 }
     60 
     61 </script>
     62 </body>
     63 
     64 </html>