зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 525f1fb9501e (bug 1453589) for ES lint failure in /builds/worker/checkouts/gecko/browser/components/preferences/in-content/tests/siteData/head.js on a CLOSED TREE
This commit is contained in:
Родитель
45bd6e8572
Коммит
db7e939b59
|
@ -210,16 +210,14 @@ add_task(async function() {
|
|||
function removeSelectedSite(hosts) {
|
||||
frameDoc = win.gSubDialog._topDialog._frame.contentDocument;
|
||||
let removeBtn = frameDoc.getElementById("removeSelected");
|
||||
is(removeBtn.disabled, true, "Should start with disabled removeSelected button");
|
||||
let sitesList = frameDoc.getElementById("sitesList");
|
||||
hosts.forEach(host => {
|
||||
let site = sitesList.querySelector(`richlistitem[host="${host}"]`);
|
||||
if (site) {
|
||||
site.click();
|
||||
let currentSelectedIndex = sitesList.selectedIndex;
|
||||
is(removeBtn.disabled, false, "Should enable the removeSelected button");
|
||||
removeBtn.doCommand();
|
||||
is(sitesList.selectedIndex, currentSelectedIndex);
|
||||
is(removeBtn.disabled, true, "Should disable the removeSelected button");
|
||||
} else {
|
||||
ok(false, `Should not select and remove inexistent site of ${host}`);
|
||||
}
|
||||
|
|
|
@ -50,14 +50,13 @@ add_task(async function() {
|
|||
|
||||
// Test the initial state
|
||||
assertSitesListed(doc, fakeHosts);
|
||||
let win = gBrowser.selectedBrowser.contentWindow;
|
||||
let frameDoc = win.gSubDialog._topDialog._frame.contentDocument;
|
||||
let removeBtn = frameDoc.getElementById("removeSelected");
|
||||
is(removeBtn.disabled, true, "Should start with disabled removeSelected button");
|
||||
|
||||
let removeDialogOpenPromise = BrowserTestUtils.promiseAlertDialogOpen("accept", REMOVE_DIALOG_URL);
|
||||
let settingsDialogClosePromise = promiseSettingsDialogClose();
|
||||
|
||||
let win = gBrowser.selectedBrowser.contentWindow;
|
||||
let frameDoc = win.gSubDialog._topDialog._frame.contentDocument;
|
||||
|
||||
// Select some sites to remove.
|
||||
let sitesList = frameDoc.getElementById("sitesList");
|
||||
fakeHosts.slice(0, 2).forEach(host => {
|
||||
|
@ -65,9 +64,10 @@ add_task(async function() {
|
|||
sitesList.addItemToSelection(site);
|
||||
});
|
||||
|
||||
let removeBtn = frameDoc.getElementById("removeSelected");
|
||||
is(removeBtn.disabled, false, "Should enable the removeSelected button");
|
||||
removeBtn.doCommand();
|
||||
is(sitesList.selectedIndex, 0, "Should select next item");
|
||||
is(removeBtn.disabled, true, "Should disable the removeSelected button");
|
||||
|
||||
let saveBtn = frameDoc.getElementById("save");
|
||||
assertSitesListed(doc, fakeHosts.slice(2));
|
||||
|
|
|
@ -140,6 +140,7 @@ function assertSitesListed(doc, hosts) {
|
|||
let site = sitesList.querySelector(`richlistitem[host="${host}"]`);
|
||||
ok(site, `Should list the site of ${host}`);
|
||||
});
|
||||
is(removeBtn.disabled, true, "Should disable the removeSelected button");
|
||||
is(removeAllBtn.disabled, false, "Should enable the removeAllBtn button");
|
||||
}
|
||||
|
||||
|
|
|
@ -259,19 +259,8 @@ let gSiteDataSettings = {
|
|||
},
|
||||
|
||||
onClickRemoveSelected() {
|
||||
let lastIndex = this._list.selectedItems.length - 1;
|
||||
let lastSelectedItem = this._list.selectedItems[lastIndex];
|
||||
let lastSelectedItemPosition = this._list.getIndexOfItem(lastSelectedItem);
|
||||
let nextSelectedItem = this._list.getItemAtIndex(lastSelectedItemPosition + 1);
|
||||
|
||||
this._removeSiteItems(this._list.selectedItems);
|
||||
this._list.clearSelection();
|
||||
|
||||
if (nextSelectedItem) {
|
||||
this._list.selectedItem = nextSelectedItem;
|
||||
} else {
|
||||
this._list.selectedIndex = this._list.itemCount - 1;
|
||||
}
|
||||
},
|
||||
|
||||
onClickRemoveAll() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче