Backed out changeset b60ccfa1448b (bug 1569855) for test_login_list.html failures CLOSED TREE

This commit is contained in:
Bogdan Tara 2019-08-06 04:37:12 +03:00
Родитель a252740d31
Коммит 3d47fb90ca
5 изменённых файлов: 7 добавлений и 62 удалений

Просмотреть файл

@ -80,10 +80,9 @@
<label for="login-sort">
<span data-l10n-id="login-list-sort-label-text"></span>
<select id="login-sort">
<option name="name" data-l10n-id="login-list-name-option" value="name"/>
<option name="last-user" data-l10n-id="login-list-last-used-option" value="last-used"/>
<option name="last-changed" data-l10n-id="login-list-last-changed-option" value="last-changed"/>
<option name="breached" data-l10n-id="login-list-breached-option" value="breached" hidden/>
<option data-l10n-id="login-list-name-option" value="name"/>
<option data-l10n-id="login-list-last-used-option" value="last-used"/>
<option data-l10n-id="login-list-last-changed-option" value="last-changed"/>
</select>
</label>
<span class="count" data-l10n-id="login-list-count" data-l10n-args='{"count": 0}'></span>

Просмотреть файл

@ -10,20 +10,6 @@ const sortFnOptions = {
name: (a, b) => collator.compare(a.title, b.title),
"last-used": (a, b) => a.timeLastUsed < b.timeLastUsed,
"last-changed": (a, b) => a.timePasswordChanged < b.timePasswordChanged,
breached: (a, b, breachesByLoginGUID) => {
if (!breachesByLoginGUID) {
return 0;
}
const aIsBreached = breachesByLoginGUID.has(a.guid);
const bIsBreached = breachesByLoginGUID.has(b.guid);
if (aIsBreached && !bIsBreached) {
return -1;
}
if (!aIsBreached && bIsBreached) {
return 1;
}
return collator.compare(a.title, b.title);
},
};
export default class LoginList extends HTMLElement {
@ -263,16 +249,7 @@ export default class LoginList extends HTMLElement {
*/
updateBreaches(breachesByLoginGUID) {
this._breachesByLoginGUID = breachesByLoginGUID;
if (this._breachesByLoginGUID.size === 0) {
return;
}
const breachedSortOptionElement = this._sortSelect.namedItem("breached");
breachedSortOptionElement.hidden = false;
this._sortSelect.selectedIndex = breachedSortOptionElement.index;
this._sortSelect.dispatchEvent(new CustomEvent("input", { bubbles: true }));
this._sortSelect.dispatchEvent(
new CustomEvent("change", { bubbles: true })
);
this.render();
}
/**
@ -372,7 +349,7 @@ export default class LoginList extends HTMLElement {
this._loginGuidsSortedOrder = this._loginGuidsSortedOrder.sort((a, b) => {
let loginA = this._logins[a].login;
let loginB = this._logins[b].login;
return sortFnOptions[sort](loginA, loginB, this._breachesByLoginGUID);
return sortFnOptions[sort](loginA, loginB);
});
}

Просмотреть файл

@ -2,8 +2,6 @@
scheme = https
support-files =
aboutlogins_common.js
prefs =
signon.management.page.breach-alerts.enabled=true
[test_confirm_delete_dialog.html]
[test_fxaccounts_button.html]

Просмотреть файл

@ -58,20 +58,10 @@ const TEST_LOGIN_3 = {
};
const TEST_BREACH = {
AddedDate: "2018-12-20T23:56:26Z",
BreachDate: "2018-12-11",
Domain: "abc.example.com",
Name: "ABC Example",
PwnCount: 1643100,
DataClasses: ["Usernames", "Passwords"],
_status: "synced",
id: "047940fe-d2fd-4314-b636-b4a952ee0043",
last_modified: "1541615610052",
schema: "1541615609018",
breachAlertURL: "https://monitor.firefox.com/breach-details/ABC-Example",
Name: "Test-Breach",
breachAlertURL: "https://monitor.firefox.com/breach-details/Test-Breach",
};
const TEST_BREACHES_MAP = new Map();
TEST_BREACHES_MAP.set(TEST_LOGIN_1.guid, TEST_BREACH);
@ -346,25 +336,7 @@ add_task(async function test_sorted_list() {
let pwChanged3 = gLoginList._logins[loginListItems[2].dataset.guid].login.timePasswordChanged;
is(pwChanged1 > pwChanged2, true, "Logins sorted by timePasswordChanged. First: " + pwChanged1 + "; Second: " + pwChanged2);
is(pwChanged2 > pwChanged3, true, "Logins sorted by timePasswordChanged. Second: " + pwChanged2 + "; Third: " + pwChanged3);
// sort by breached when there are breached logins
gLoginList.updateBreaches(TEST_BREACHES_MAP);
loginSort.selectedIndex = 3;
dispatchChangeEvent(loginSort);
loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item:not([hidden])");
is(loginListItems[0].classList.contains("breached"), true, "Breached login should be displayed at top of list");
is(!loginListItems[1].classList.contains("breached"), true, "Non-breached login should be displayed below breached");
// sort by name when there are no breached logins
gLoginList.updateBreaches(new Map());
loginSort.selectedIndex = 3;
dispatchChangeEvent(loginSort);
loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item:not([hidden])");
title1 = loginListItems[0]._login.title;
title2 = loginListItems[1]._login.title;
is(title1.localeCompare(title2), -1, "Logins should be sorted alphabetically by hostname");
});
</script>
</body>

Просмотреть файл

@ -45,7 +45,6 @@ login-list-count =
}
login-list-sort-label-text = Sort by:
login-list-name-option = Name (A-Z)
login-list-breached-option = Breached Websites
login-list-last-changed-option = Last Modified
login-list-last-used-option = Last Used
login-list-intro-title = No logins found