tor-browser

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

test_focused_link_scroll.xhtml (1338B)


      1 <?xml version="1.0"?>
      2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
      3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
      4 
      5 <window title="Focus Scroll Tests"
      6  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
      7 
      8  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
      9  <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
     10 
     11 <body xmlns="http://www.w3.org/1999/xhtml">
     12 <div id="div" style="width:500px;height:48px;overflow:auto;font-size:16px;line-height:16px;">
     13 aaaaaaaaa<br/>bbbbbbbb<br/>
     14 <a href="about:blank;" id="a">ccccccccc<br/>ddddddddd</a>
     15 </div>
     16 <p id="display">
     17 </p>
     18 <div id="content" style="display: none">
     19 </div>
     20 <pre id="test">
     21 </pre>
     22 </body>
     23 
     24 <script>
     25 
     26 SimpleTest.waitForExplicitFinish();
     27 
     28 function runTest()
     29 {
     30  var fm = Cc["@mozilla.org/focus-manager;1"].
     31             getService(Ci.nsIFocusManager);
     32  var div = document.getElementById('div');
     33  var a = document.getElementById('a');
     34  synthesizeMouse(a, 4, 4, { type: "mousedown" }, window);
     35  is(fm.focusedElement, a,
     36     "The anchor element isn't set focus by the mouse down event");
     37  is(div.scrollTop, 0,
     38     "The div element was scrolled by the mouse down event");
     39  SimpleTest.finish();
     40 }
     41 
     42 SimpleTest.waitForFocus(runTest);
     43 
     44 </script>
     45 
     46 </window>