зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1896360
- Disable Add button when no language is selected. r=mconley
Differential Revision: https://phabricator.services.mozilla.com/D210206
This commit is contained in:
Родитель
73a678be93
Коммит
3a069ac693
|
@ -225,6 +225,7 @@ var gLanguagesDialog = {
|
|||
|
||||
this._acceptLanguages[selectedID] = true;
|
||||
this._availableLanguages.selectedItem = null;
|
||||
this.onAvailableLanguageSelect();
|
||||
|
||||
// Rebuild the available list with the added item removed...
|
||||
this._buildAvailableLanguageList().catch(console.error);
|
||||
|
|
|
@ -19,6 +19,11 @@ add_task(async function () {
|
|||
button.doCommand();
|
||||
}
|
||||
|
||||
function cancelLanguagesSubdialog(win) {
|
||||
const button = win.document.querySelector("dialog").getButton("cancel");
|
||||
button.doCommand();
|
||||
}
|
||||
|
||||
ok(BrowserTestUtils.isHidden(dialogOverlay), "The dialog is invisible.");
|
||||
let win = await languagesSubdialogOpened();
|
||||
ok(
|
||||
|
@ -168,5 +173,47 @@ add_task(async function () {
|
|||
);
|
||||
acceptLanguagesSubdialog(win);
|
||||
|
||||
// Testing adding from the available languages list
|
||||
win = await languagesSubdialogOpened();
|
||||
ok(
|
||||
win.document.getElementById("addButton").disabled,
|
||||
"The Add button is disabled after opening the Languages dialog"
|
||||
);
|
||||
|
||||
win.document.getElementById("availableLanguages").click();
|
||||
ok(
|
||||
win.document.getElementById("addButton").disabled,
|
||||
"The Add button is disabled after clicking on the available languages list"
|
||||
);
|
||||
|
||||
let availableLanguages =
|
||||
win.document.getElementById("availableLanguages").menupopup;
|
||||
let target = availableLanguages.querySelector("#he");
|
||||
target.click();
|
||||
is(
|
||||
win.document.getElementById("addButton").disabled,
|
||||
false,
|
||||
"The Add button is enabled after selecting a language from the available languages list"
|
||||
);
|
||||
win.document.getElementById("addButton").click();
|
||||
activeLanguages = win.document.getElementById("activeLanguages").children;
|
||||
Assert.equal(
|
||||
activeLanguages[0].id,
|
||||
"he",
|
||||
"Hebrew language added as topmost item."
|
||||
);
|
||||
|
||||
ok(
|
||||
win.document.getElementById("addButton").disabled,
|
||||
"The Add button is disabled after the selected language has been added"
|
||||
);
|
||||
is(
|
||||
win.document.getElementById("activeLanguages").children[0].id,
|
||||
"he",
|
||||
"Hebrew language added as topmost item."
|
||||
);
|
||||
|
||||
cancelLanguagesSubdialog(win);
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче