зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1374852 - Visiting preferences should always focus on search field r=jaws
MozReview-Commit-ID: H8vJP9jUjRz --HG-- extra : rebase_source : aa5e7ab4d5a00d7a79c7b3ab5456de0f1dd81759
This commit is contained in:
Родитель
56edc85a6e
Коммит
237975e280
|
@ -9,15 +9,20 @@ var gSearchResultsPane = {
|
|||
listSearchMenuitemIndicators: new Set(),
|
||||
searchResultsCategory: null,
|
||||
searchInput: null,
|
||||
inited: false,
|
||||
|
||||
init() {
|
||||
if (this.inited) {
|
||||
return;
|
||||
}
|
||||
this.inited = true;
|
||||
this.searchResultsCategory = document.getElementById("category-search-results");
|
||||
|
||||
this.searchInput = document.getElementById("searchInput");
|
||||
this.searchInput.hidden = !Services.prefs.getBoolPref("browser.preferences.search");
|
||||
if (!this.searchInput.hidden) {
|
||||
this.initializeCategories();
|
||||
this.searchInput.addEventListener("command", this);
|
||||
this.searchInput.addEventListener("focus", this);
|
||||
this.searchInput.focus();
|
||||
|
||||
// Throttling the resize event to reduce the callback frequency
|
||||
let callbackId;
|
||||
|
@ -37,8 +42,6 @@ var gSearchResultsPane = {
|
|||
handleEvent(event) {
|
||||
if (event.type === "command") {
|
||||
this.searchFunction(event);
|
||||
} else if (event.type === "focus") {
|
||||
this.initializeCategories();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -45,7 +45,10 @@ add_task(async function() {
|
|||
|
||||
// Performs search
|
||||
let searchInput = gBrowser.contentDocument.getElementById("searchInput");
|
||||
searchInput.focus();
|
||||
|
||||
is(searchInput, gBrowser.contentDocument.activeElement.closest("#searchInput"),
|
||||
"Search input should be focused when visiting preferences");
|
||||
|
||||
searchInput.value = "password";
|
||||
searchInput.doCommand();
|
||||
|
||||
|
@ -84,7 +87,10 @@ add_task(async function() {
|
|||
|
||||
// Performs search
|
||||
let searchInput = gBrowser.contentDocument.getElementById("searchInput");
|
||||
searchInput.focus();
|
||||
|
||||
is(searchInput, gBrowser.contentDocument.activeElement.closest("#searchInput"),
|
||||
"Search input should be focused when visiting preferences");
|
||||
|
||||
searchInput.value = "password";
|
||||
searchInput.doCommand();
|
||||
|
||||
|
@ -141,7 +147,10 @@ add_task(async function() {
|
|||
|
||||
// Performs search
|
||||
let searchInput = gBrowser.contentDocument.getElementById("searchInput");
|
||||
searchInput.focus();
|
||||
|
||||
is(searchInput, gBrowser.contentDocument.activeElement.closest("#searchInput"),
|
||||
"Search input should be focused when visiting preferences");
|
||||
|
||||
searchInput.value = "coach";
|
||||
searchInput.doCommand();
|
||||
|
||||
|
@ -167,7 +176,10 @@ add_task(async function() {
|
|||
|
||||
// Performs search
|
||||
let searchInput = gBrowser.contentDocument.getElementById("searchInput");
|
||||
searchInput.focus();
|
||||
|
||||
is(searchInput, gBrowser.contentDocument.activeElement.closest("#searchInput"),
|
||||
"Search input should be focused when visiting preferences");
|
||||
|
||||
searchInput.value = "password";
|
||||
searchInput.doCommand();
|
||||
|
||||
|
@ -194,7 +206,10 @@ add_task(async function() {
|
|||
|
||||
// Performs search
|
||||
let searchInput = gBrowser.contentDocument.getElementById("searchInput");
|
||||
searchInput.focus();
|
||||
|
||||
is(searchInput, gBrowser.contentDocument.activeElement.closest("#searchInput"),
|
||||
"Search input should be focused when visiting preferences");
|
||||
|
||||
searchInput.value = "site data";
|
||||
searchInput.doCommand();
|
||||
|
||||
|
@ -220,7 +235,10 @@ add_task(async function() {
|
|||
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
|
||||
let searchInput = gBrowser.contentDocument.getElementById("searchInput");
|
||||
let searchResultsCategory = gBrowser.contentDocument.getElementById("category-search-results");
|
||||
searchInput.focus();
|
||||
|
||||
is(searchInput, gBrowser.contentDocument.activeElement.closest("#searchInput"),
|
||||
"Search input should be focused when visiting preferences");
|
||||
|
||||
searchInput.value = "password";
|
||||
searchInput.doCommand();
|
||||
is(searchResultsCategory.hidden, false, "search results category should be shown");
|
||||
|
|
|
@ -27,7 +27,10 @@ add_task(async function() {
|
|||
|
||||
// Performs search.
|
||||
let searchInput = gBrowser.contentDocument.getElementById("searchInput");
|
||||
searchInput.focus();
|
||||
|
||||
is(searchInput, gBrowser.contentDocument.activeElement.closest("#searchInput"),
|
||||
"Search input should be focused when visiting preferences");
|
||||
|
||||
searchInput.value = "Create Account";
|
||||
searchInput.doCommand();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче