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 /toolkit/content/tests/browser/browser_label_textlink.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 'toolkit/content/tests/browser/browser_label_textlink.js')
-rw-r--r-- | toolkit/content/tests/browser/browser_label_textlink.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/toolkit/content/tests/browser/browser_label_textlink.js b/toolkit/content/tests/browser/browser_label_textlink.js new file mode 100644 index 000000000..861086707 --- /dev/null +++ b/toolkit/content/tests/browser/browser_label_textlink.js @@ -0,0 +1,38 @@ +add_task(function* () { + yield BrowserTestUtils.withNewTab({gBrowser, url: "about:config"}, function*(browser) { + let newTabURL = "http://www.example.com/"; + yield ContentTask.spawn(browser, newTabURL, function*(newTabURL) { + let doc = content.document; + let label = doc.createElement("label"); + label.href = newTabURL; + label.id = "textlink-test"; + label.className = "text-link"; + label.textContent = "click me"; + doc.documentElement.append(label); + }); + + // Test that click will open tab in foreground. + let awaitNewTab = BrowserTestUtils.waitForNewTab(gBrowser, newTabURL); + yield BrowserTestUtils.synthesizeMouseAtCenter("#textlink-test", {}, browser); + let newTab = yield awaitNewTab; + is(newTab.linkedBrowser, gBrowser.selectedBrowser, "selected tab should be example page"); + yield BrowserTestUtils.removeTab(gBrowser.selectedTab); + + // Test that ctrl+shift+click/meta+shift+click will open tab in background. + awaitNewTab = BrowserTestUtils.waitForNewTab(gBrowser, newTabURL); + yield BrowserTestUtils.synthesizeMouseAtCenter("#textlink-test", + {ctrlKey: true, metaKey: true, shiftKey: true}, + browser); + yield awaitNewTab; + is(gBrowser.selectedBrowser, browser, "selected tab should be original tab"); + yield BrowserTestUtils.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]); + + // Middle-clicking should open tab in foreground. + awaitNewTab = BrowserTestUtils.waitForNewTab(gBrowser, newTabURL); + yield BrowserTestUtils.synthesizeMouseAtCenter("#textlink-test", + {button: 1}, browser); + newTab = yield awaitNewTab; + is(newTab.linkedBrowser, gBrowser.selectedBrowser, "selected tab should be example page"); + yield BrowserTestUtils.removeTab(gBrowser.tabs[gBrowser.tabs.length - 1]); + }); +}); |