dom/tests/mochitest/chrome/test_focused_link_scroll.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/chrome/test_focused_link_scroll.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,48 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     1.7 +
     1.8 +<window title="Focus Scroll Tests"
     1.9 +  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.10 +
    1.11 +  <script type="application/javascript"
    1.12 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    1.13 +  <script type="application/javascript"
    1.14 +          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
    1.15 +
    1.16 +<body xmlns="http://www.w3.org/1999/xhtml">
    1.17 +<div id="div" style="width:500px;height:48px;overflow:auto;font-size:16px;line-height:16px;">
    1.18 +aaaaaaaaa<br/>bbbbbbbb<br/>
    1.19 +<a href="about:blank;" id="a">ccccccccc<br/>ddddddddd</a>
    1.20 +</div>
    1.21 +<p id="display">
    1.22 +</p>
    1.23 +<div id="content" style="display: none">
    1.24 +</div>
    1.25 +<pre id="test">
    1.26 +</pre>
    1.27 +</body>
    1.28 +
    1.29 +<script>
    1.30 +
    1.31 +SimpleTest.waitForExplicitFinish();
    1.32 +
    1.33 +function runTest()
    1.34 +{
    1.35 +  var fm = Components.classes["@mozilla.org/focus-manager;1"].
    1.36 +             getService(Components.interfaces.nsIFocusManager);
    1.37 +  var div = document.getElementById('div');
    1.38 +  var a = document.getElementById('a');
    1.39 +  synthesizeMouse(a, 4, 4, { type: "mousedown" }, window);
    1.40 +  is(fm.focusedElement, a,
    1.41 +     "The anchor element isn't set focus by the mouse down event");
    1.42 +  is(div.scrollTop, 0,
    1.43 +     "The div element was scrolled by the mouse down event");
    1.44 +  SimpleTest.finish();
    1.45 +}
    1.46 +
    1.47 +SimpleTest.waitForFocus(runTest);
    1.48 +
    1.49 +</script>
    1.50 +
    1.51 +</window>

mercurial