browser/base/content/test/general/browser_visibleFindSelection.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:86d16aa76088
1
2 function test() {
3 waitForExplicitFinish();
4
5 let tab = gBrowser.addTab();
6 gBrowser.selectedTab = tab;
7 tab.linkedBrowser.addEventListener("load", function(aEvent) {
8 tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
9
10 ok(true, "Load listener called");
11 waitForFocus(onFocus, content);
12 }, true);
13
14 content.location = "data:text/html,<div style='position: absolute; left: 2200px; background: green; width: 200px; height: 200px;'>div</div><div style='position: absolute; left: 0px; background: red; width: 200px; height: 200px;'><span id='s'>div</span></div>";
15 }
16
17 function onFocus() {
18 EventUtils.synthesizeKey("f", { accelKey: true });
19 ok(gFindBarInitialized, "find bar is now initialized");
20
21 EventUtils.synthesizeKey("d", {});
22 EventUtils.synthesizeKey("i", {});
23 EventUtils.synthesizeKey("v", {});
24 // finds the div in the green box
25
26 EventUtils.synthesizeKey("g", { accelKey: true });
27 // finds the div in the red box
28
29 var rect = content.document.getElementById("s").getBoundingClientRect();
30 ok(rect.left >= 0, "scroll should include find result");
31
32 // clear the find bar
33 EventUtils.synthesizeKey("a", { accelKey: true });
34 EventUtils.synthesizeKey("VK_DELETE", { });
35
36 gFindBar.close();
37 gBrowser.removeCurrentTab();
38 finish();
39 }

mercurial