diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /browser/base/content/test/general/browser_visibleFindSelection.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'browser/base/content/test/general/browser_visibleFindSelection.js')
-rw-r--r-- | browser/base/content/test/general/browser_visibleFindSelection.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/browser/base/content/test/general/browser_visibleFindSelection.js b/browser/base/content/test/general/browser_visibleFindSelection.js new file mode 100644 index 000000000..630490644 --- /dev/null +++ b/browser/base/content/test/general/browser_visibleFindSelection.js @@ -0,0 +1,52 @@ +add_task(function*() { + const childContent = "<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>"; + + let tab = gBrowser.selectedTab = gBrowser.addTab(); + + yield promiseTabLoadEvent(tab, "data:text/html," + escape(childContent)); + yield SimpleTest.promiseFocus(gBrowser.selectedBrowser.contentWindowAsCPOW); + + let findBarOpenPromise = promiseWaitForEvent(gBrowser, "findbaropen"); + EventUtils.synthesizeKey("f", { accelKey: true }); + yield findBarOpenPromise; + + ok(gFindBarInitialized, "find bar is now initialized"); + + // Finds the div in the green box. + let scrollPromise = promiseWaitForEvent(gBrowser, "scroll"); + EventUtils.synthesizeKey("d", {}); + EventUtils.synthesizeKey("i", {}); + EventUtils.synthesizeKey("v", {}); + yield scrollPromise; + + // Wait for one paint to ensure we've processed the previous key events and scrolling. + yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () { + return new Promise( + resolve => { + content.requestAnimationFrame(() => { + setTimeout(resolve, 0); + }); + } + ); + }); + + // Finds the div in the red box. + scrollPromise = promiseWaitForEvent(gBrowser, "scroll"); + EventUtils.synthesizeKey("g", { accelKey: true }); + yield scrollPromise; + + yield ContentTask.spawn(gBrowser.selectedBrowser, null, function* () { + Assert.ok(content.document.getElementById("s").getBoundingClientRect().left >= 0, + "scroll should include find result"); + }); + + // clear the find bar + EventUtils.synthesizeKey("a", { accelKey: true }); + EventUtils.synthesizeKey("VK_DELETE", { }); + + gFindBar.close(); + gBrowser.removeCurrentTab(); +}); + |