Commit 92804fa5 authored by jdoerrie's avatar jdoerrie Committed by Commit Bot

Fix Undo Toast Behavior

This change fixes the undo toast so that navigating away from the
password settings page will hide it if shown.

Bug: 779945
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I0e10f352701c7caf356e070f2b4c6f7cd8b59b41
Reviewed-on: https://chromium-review.googlesource.com/779200Reviewed-by: default avatarHector Carmona <hcarmona@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#519438}
parent 0982a27e
...@@ -356,6 +356,9 @@ Polymer({ ...@@ -356,6 +356,9 @@ Polymer({
this.passwordManager_.removeExceptionListChangedListener( this.passwordManager_.removeExceptionListChangedListener(
/** @type {function(!Array<PasswordManager.ExceptionEntry>):void} */ ( /** @type {function(!Array<PasswordManager.ExceptionEntry>):void} */ (
this.setPasswordExceptionsListener_)); this.setPasswordExceptionsListener_));
if (this.$.undoToast.open)
this.$.undoToast.hide();
}, },
/** /**
......
...@@ -572,6 +572,26 @@ TEST_F('SettingsPasswordSectionBrowserTest', 'uiTests', function() { ...@@ -572,6 +572,26 @@ TEST_F('SettingsPasswordSectionBrowserTest', 'uiTests', function() {
MockInteractions.tap(exportDialog.$.exportPasswordsButton); MockInteractions.tap(exportDialog.$.exportPasswordsButton);
}); });
test('closingPasswordsSectionHidesUndoToast', function(done) {
var passwordEntry = FakeDataMaker.passwordEntry('goo.gl', 'bart', 1);
var passwordsSection =
createPasswordsSection(passwordManager, [passwordEntry], []);
// Click the remove button on the first password and assert that an undo
// toast is shown.
var firstNode = Polymer.dom(passwordsSection.$.passwordList).children[1];
MockInteractions.tap(firstNode.$$('#passwordMenu'));
MockInteractions.tap(passwordsSection.$.menuRemovePassword);
assertTrue(passwordsSection.$.undoToast.open);
// Remove the passwords section from the DOM and check that this closes
// the undo toast.
document.body.removeChild(passwordsSection);
assertFalse(passwordsSection.$.undoToast.open);
done();
});
}); });
mocha.run(); mocha.run();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment