dom/tests/mochitest/chrome/test_focused_link_scroll.xul

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial