Bug 1559993 - Show 'Password saved' toast when automatically saving a generated password. r=MattN

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tim Nguyen 2019-07-12 22:02:13 +00:00
Родитель 0ca0f2dea1
Коммит a2577500f4
3 изменённых файлов: 32 добавлений и 2 удалений

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

@ -1077,6 +1077,7 @@ confirmationHint.pageBookmarked.label = Saved to Library!
confirmationHint.addSearchEngine.label = Search engine added!
confirmationHint.pinTab.label = Pinned!
confirmationHint.pinTab.description = Right-click the tab to unpin it.
confirmationHint.passwordSaved.label = Password saved!
# LOCALIZATION NOTE (livebookmarkMigration.title):
# Used by the export of user's live bookmarks to an OPML file as a title for the file.

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

@ -1210,9 +1210,11 @@ LoginManagerPrompter.prototype = {
"togglePasswordAccessKey2"
);
this._getPopupNote().show(
let popupNote = this._getPopupNote();
let notificationID = "password";
popupNote.show(
browser,
"password",
notificationID,
promptMsg,
"password-notification-icon",
mainAction,
@ -1294,6 +1296,12 @@ LoginManagerPrompter.prototype = {
options
)
);
if (options.notifySaved) {
let notification = popupNote.getNotification(notificationID);
let anchor = notification.anchorElement;
anchor.ownerGlobal.ConfirmationHint.show(anchor, "passwordSaved");
}
},
_removeLoginNotifications() {

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

@ -137,6 +137,12 @@ add_task(async function autocomplete_generated_password_auto_saved() {
usernameInput.setUserInput("user1");
}
);
let confirmationHint = document.getElementById("confirmation-hint");
let hintPromiseShown = BrowserTestUtils.waitForEvent(
confirmationHint,
"popupshown",
);
await fillGeneratedPasswordFromACPopup(browser, passwordInputSelector);
await ContentTask.spawn(
browser,
@ -151,6 +157,21 @@ add_task(async function autocomplete_generated_password_auto_saved() {
}
);
// Make sure confirmation hint was shown
await hintPromiseShown;
Assert.equal(
confirmationHint.anchorNode.id,
"password-notification-icon",
"Hint should be anchored on the password notification icon"
);
let hintPromiseHidden = BrowserTestUtils.waitForEvent(
confirmationHint,
"popuphidden",
);
await hintPromiseHidden;
// check a dismissed prompt was shown with extraAttr attribute
let notif = getCaptureDoorhanger("password-save");
ok(notif && notif.dismissed, "Dismissed notification was created");