Bug 1556045 - Revealing a password then selecting another login should reset the reveal-checkbox state. r=_6a68

Differential Revision: https://phabricator.services.mozilla.com/D33321

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jared Wein 2019-05-31 21:18:28 +00:00
Родитель 971ba041d1
Коммит 0043cfc344
2 изменённых файлов: 25 добавлений и 0 удалений

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

@ -127,6 +127,8 @@ class ModalInput extends ReflectedFluentElement {
} else {
lockedValue.textContent = val;
}
let revealCheckbox = this.shadowRoot.querySelector(".reveal-checkbox");
revealCheckbox.checked = false;
}
checkValidity() {

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

@ -37,6 +37,16 @@ const TEST_LOGIN_1 = {
timeLastUsed: "4000",
};
const TEST_LOGIN_2 = {
guid: "987654321",
hostname: "https://example.com",
username: "user2",
password: "pass2",
timeCreated: "2000",
timePasswordChanged: "4000",
timeLastUsed: "8000",
};
add_task(async function setup() {
stubFluentL10n({
"time-created": "timeCreated",
@ -130,6 +140,19 @@ add_task(async function test_edit_login_cancel() {
}
});
add_task(async function test_reveal_password_change_selected_login() {
gLoginItem.setLogin(TEST_LOGIN_1);
let passwordInput = gLoginItem.shadowRoot.querySelector('modal-input[name="password"]');
let revealCheckbox = passwordInput.shadowRoot.querySelector(".reveal-checkbox");
ok(!revealCheckbox.checked, "reveal-checkbox should not be checked by default");
revealCheckbox.click();
ok(revealCheckbox.checked, "reveal-checkbox should be checked after clicking");
gLoginItem.setLogin(TEST_LOGIN_2);
ok(!revealCheckbox.checked, "reveal-checkbox should be unchecked when changing logins");
});
add_task(async function test_set_login_empty() {
gLoginItem.setLogin({});
await asyncElementRendered();