-
-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow various clickSelectsAll behaviour.
- Loading branch information
Showing
5 changed files
with
88 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
browser/components/urlbar/tests/browser/browser_doubleClickSelectsAll.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
function doubleClick(target) { | ||
let promise = BrowserTestUtils.waitForEvent(target, "dblclick"); | ||
EventUtils.synthesizeMouseAtCenter( | ||
target, | ||
{ clickCount: 1 }, | ||
target.ownerGlobal | ||
); | ||
EventUtils.synthesizeMouseAtCenter( | ||
target, | ||
{ clickCount: 2 }, | ||
target.ownerGlobal | ||
); | ||
return promise; | ||
} | ||
|
||
add_task(async function() { | ||
await SpecialPowers.pushPrefEnv({ | ||
set: [ | ||
["browser.urlbar.clickSelectsAll", false], | ||
["browser.urlbar.doubleClickSelectsAll", true], | ||
], | ||
}); | ||
|
||
let url = "about:mozilla"; | ||
let win = await BrowserTestUtils.openNewBrowserWindow(); | ||
await BrowserTestUtils.openNewForegroundTab({ gBrowser: win.gBrowser, url }); | ||
|
||
await doubleClick(win.gURLBar.inputField); | ||
is( | ||
win.gURLBar.selectionStart, | ||
0, | ||
"Selection should start at the beginning of the urlbar value" | ||
); | ||
is( | ||
win.gURLBar.selectionEnd, | ||
url.length, | ||
"Selection should end at the end of the urlbar value" | ||
); | ||
|
||
win.close(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters