summaryrefslogtreecommitdiff
path: root/browser/base/content/test/browser_visibleFindSelection.js
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2014-05-21 11:38:25 +0200
committerwolfbeast <mcwerewolf@gmail.com>2014-05-21 11:38:25 +0200
commitd25ba7d760b017b038e5aa6c0a605b4a330eb68d (patch)
tree16ec27edc7d5f83986f16236d3a36a2682a0f37e /browser/base/content/test/browser_visibleFindSelection.js
parenta942906574671868daf122284a9c4689e6924f74 (diff)
downloadpalemoon-gre-d25ba7d760b017b038e5aa6c0a605b4a330eb68d.tar.gz
Recommit working copy to repo with proper line endings.
Diffstat (limited to 'browser/base/content/test/browser_visibleFindSelection.js')
-rw-r--r--browser/base/content/test/browser_visibleFindSelection.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/browser/base/content/test/browser_visibleFindSelection.js b/browser/base/content/test/browser_visibleFindSelection.js
new file mode 100644
index 000000000..b46104ad4
--- /dev/null
+++ b/browser/base/content/test/browser_visibleFindSelection.js
@@ -0,0 +1,39 @@
+
+function test() {
+ waitForExplicitFinish();
+
+ let tab = gBrowser.addTab();
+ gBrowser.selectedTab = tab;
+ tab.linkedBrowser.addEventListener("load", function(aEvent) {
+ tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
+
+ ok(true, "Load listener called");
+ waitForFocus(onFocus, content);
+ }, true);
+
+ 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>";
+}
+
+function onFocus() {
+ EventUtils.synthesizeKey("f", { accelKey: true });
+ ok(gFindBarInitialized, "find bar is now initialized");
+
+ EventUtils.synthesizeKey("d", {});
+ EventUtils.synthesizeKey("i", {});
+ EventUtils.synthesizeKey("v", {});
+ // finds the div in the green box
+
+ EventUtils.synthesizeKey("g", { accelKey: true });
+ // finds the div in the red box
+
+ var rect = content.document.getElementById("s").getBoundingClientRect();
+ ok(rect.left >= 0, "scroll should include find result");
+
+ // clear the find bar
+ EventUtils.synthesizeKey("a", { accelKey: true });
+ EventUtils.synthesizeKey("VK_DELETE", { });
+
+ gFindBar.close();
+ gBrowser.removeCurrentTab();
+ finish();
+}