Commit af66a5fe authored by Mohamed Amir Yosef's avatar Mohamed Amir Yosef Committed by Chromium LUCI CQ

[Passwords] Update the footers of moving multiple passwords dialog ...

to be aligned with the latest mocks.
Basically we will show a static string and the user email.

This is reverting most of the code in https://crrev.com/c/2550821

and doing minor modifications

Screenshot: https://screenshot.googleplex.com/9zuD5cB5UhSiCDc

Bug: 1139263
Change-Id: Ib6adbf8d49e80b07dcb74e98d4fd27b0a97237a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2595531Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
Commit-Queue: Mohamed Amir Yosef <mamir@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837993}
parent 8d59fda0
...@@ -564,12 +564,6 @@ ...@@ -564,12 +564,6 @@
Move them to your Google Account, and make it across-device accessible Move them to your Google Account, and make it across-device accessible
</message> </message>
<!-- TODO(crbug.com/1139263): Make it translateable and add translation screenshots once final mocks are available. --> <!-- TODO(crbug.com/1139263): Make it translateable and add translation screenshots once final mocks are available. -->
<message translateable="false" name="IDS_SETTINGS_PASSWORD_MOVE_PASSWORDS_TO_ACCOUNT_COUNT" desc="Message shown in the footer of the moving multiple password to the Google Account dialog. It reflects how many passwords are selected and will be movec.">
{COUNT, plural,
=1 {You are moving {COUNT} password from your device to your Google Account}
other {You are moving {COUNT} passwords from your device to your Google Account}}
</message>
<!-- TODO(crbug.com/1139263): Make it translateable and add translation screenshots once final mocks are available. -->
<message translateable="false" name="IDS_SETTINGS_PASSWORD_MOVE_PASSWORDS_TO_ACCOUNT_DIALOG_TITLE" desc="Title for the dialog that asks the user to select which passwords to move to their Google Account."> <message translateable="false" name="IDS_SETTINGS_PASSWORD_MOVE_PASSWORDS_TO_ACCOUNT_DIALOG_TITLE" desc="Title for the dialog that asks the user to select which passwords to move to their Google Account.">
Choose which passwords to move Choose which passwords to move
</message> </message>
......
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
<div slot="body"> <div slot="body">
<dom-repeat id="devicePasswordList" items="[[passwordsToMove]]" <dom-repeat id="devicePasswordList" items="[[passwordsToMove]]"
class="cr-separators list-with-header" class="cr-separators list-with-header">
on-rendered-item-count-changed="updateMovingPasswordsCountLabel_">
<template> <template>
<password-list-item entry="[[item]]" <password-list-item entry="[[item]]"
tabindex$="[[tabIndex]]" focus-row-index="[[index]]" tabindex$="[[tabIndex]]" focus-row-index="[[index]]"
...@@ -30,8 +29,7 @@ ...@@ -30,8 +29,7 @@
last-focused="{{lastFocused_}}" list-blurred="{{listBlurred_}}" last-focused="{{lastFocused_}}" list-blurred="{{listBlurred_}}"
should-hide-more-actions-button> should-hide-more-actions-button>
<cr-checkbox slot="checkbox" id="checkbox" checked="true" <cr-checkbox slot="checkbox" id="checkbox" checked="true"
data-id$="[[item.deviceId_]]" data-id$="[[item.deviceId_]]">
on-checked-changed="updateMovingPasswordsCountLabel_">
</cr-checkbox> </cr-checkbox>
</password-list-item> </password-list-item>
</template> </template>
...@@ -52,8 +50,9 @@ ...@@ -52,8 +50,9 @@
<div class="cr-row two-line "> <div class="cr-row two-line ">
<settings-avatar-icon></settings-avatar-icon> <settings-avatar-icon></settings-avatar-icon>
<div class="flex cr-padded-text"> <div class="flex cr-padded-text">
<div id="movingPasswordsCountLabel">[[movingPasswordsCountLabel_]]</div> <div id="movingPasswordsCountLabel">
<div class="secondary">$i18n{passwordMovePasswordsToAccount}</div> $i18n{passwordMovePasswordsToAccount}</div>
<div class="secondary">[[accountEmail]]</div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
import './password_list_item.js'; import './password_list_item.js';
import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js'; import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js';
import {PluralStringProxyImpl} from 'chrome://resources/js/plural_string_proxy.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {MultiStorePasswordUiEntry} from './multi_store_password_ui_entry.js'; import {MultiStorePasswordUiEntry} from './multi_store_password_ui_entry.js';
...@@ -31,11 +30,7 @@ Polymer({ ...@@ -31,11 +30,7 @@ Polymer({
type: Array, type: Array,
value: () => [], value: () => [],
}, },
/** @private */ accountEmail: String,
movingPasswordsCountLabel_: {
type: String,
value: '',
},
}, },
/** @override */ /** @override */
...@@ -67,16 +62,4 @@ Polymer({ ...@@ -67,16 +62,4 @@ Polymer({
onCancelButtonClick_() { onCancelButtonClick_() {
this.$.dialog.close(); this.$.dialog.close();
}, },
updateMovingPasswordsCountLabel_() {
const checkboxes = this.$.dialog.querySelectorAll('cr-checkbox');
const selectedPasswordsCount =
Array.from(checkboxes).filter(box => box.checked).length;
PluralStringProxyImpl.getInstance()
.getPluralString('movePasswordsToAccount', selectedPasswordsCount)
.then(label => {
this.movingPasswordsCountLabel_ = label;
});
},
}); });
...@@ -98,6 +98,7 @@ ...@@ -98,6 +98,7 @@
<template is="dom-if" if="[[showMoveMultiplePasswordsDialog_]]" restamp> <template is="dom-if" if="[[showMoveMultiplePasswordsDialog_]]" restamp>
<password-move-multiple-passwords-to-account-dialog <password-move-multiple-passwords-to-account-dialog
passwords-to-move="[[allDevicePasswords_]]" passwords-to-move="[[allDevicePasswords_]]"
account-email="[[accountEmail_]]"
on-close="onMoveMultiplePasswordsDialogClose_"> on-close="onMoveMultiplePasswordsDialogClose_">
</password-move-multiple-passwords-to-account-dialog> </password-move-multiple-passwords-to-account-dialog>
</template> </template>
...@@ -331,9 +331,6 @@ SettingsUI::SettingsUI(content::WebUI* web_ui) ...@@ -331,9 +331,6 @@ SettingsUI::SettingsUI(content::WebUI* web_ui)
IDS_SETTINGS_WEAK_PASSWORDS_COUNT); IDS_SETTINGS_WEAK_PASSWORDS_COUNT);
plural_string_handler->AddLocalizedString("securityKeysNewPIN", plural_string_handler->AddLocalizedString("securityKeysNewPIN",
IDS_SETTINGS_SECURITY_KEYS_NEW_PIN); IDS_SETTINGS_SECURITY_KEYS_NEW_PIN);
plural_string_handler->AddLocalizedString(
"movePasswordsToAccount",
IDS_SETTINGS_PASSWORD_MOVE_PASSWORDS_TO_ACCOUNT_COUNT);
plural_string_handler->AddLocalizedString( plural_string_handler->AddLocalizedString(
"safetyCheckPasswordsCompromised", "safetyCheckPasswordsCompromised",
IDS_SETTINGS_COMPROMISED_PASSWORDS_COUNT_SHORT); IDS_SETTINGS_COMPROMISED_PASSWORDS_COUNT_SHORT);
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
/** @fileoverview Runs the Polymer tests for the PasswordsDeviceSection page. */ /** @fileoverview Runs the Polymer tests for the PasswordsDeviceSection page. */
import {PluralStringProxyImpl} from 'chrome://resources/js/plural_string_proxy.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {MultiStorePasswordUiEntry, PasswordManagerImpl, Router, routes, SyncBrowserProxyImpl} from 'chrome://settings/settings.js'; import {MultiStorePasswordUiEntry, PasswordManagerImpl, Router, routes, SyncBrowserProxyImpl} from 'chrome://settings/settings.js';
import {createMultiStorePasswordEntry, createPasswordEntry, PasswordDeviceSectionElementFactory} from 'chrome://test/settings/passwords_and_autofill_fake_data.js'; import {createMultiStorePasswordEntry, createPasswordEntry, PasswordDeviceSectionElementFactory} from 'chrome://test/settings/passwords_and_autofill_fake_data.js';
...@@ -366,36 +365,4 @@ suite('PasswordsDeviceSection', function() { ...@@ -366,36 +365,4 @@ suite('PasswordsDeviceSection', function() {
assertTrue(firstPasswordItem.$.moreActionsButton.hidden); assertTrue(firstPasswordItem.$.moreActionsButton.hidden);
}); });
// Testing moving multiple password dialog footer reflects how many passwords
// are going to be moved.
test('moveMultiplePasswordsDialogFooter', async function() {
const deviceEntry1 = createMultiStorePasswordEntry(
{url: 'goo.gl', username: 'bart1', deviceId: 41});
const deviceEntry2 = createMultiStorePasswordEntry(
{url: 'goo.gl', username: 'bart2', deviceId: 54});
const moveMultipleDialog = elementFactory.createMoveMultiplePasswordsDialog(
[deviceEntry1, deviceEntry2]);
flush();
let expectedCountLabel =
await PluralStringProxyImpl.getInstance().getPluralString(
'movePasswordsToAccount', 2);
let countLabel =
moveMultipleDialog.$$('#movingPasswordsCountLabel').textContent.trim();
expectEquals(expectedCountLabel, countLabel);
// Uncheck the first entry
const firstPasswordItem = moveMultipleDialog.$$('password-list-item');
firstPasswordItem.querySelector('cr-checkbox').click();
// The footer should have been updated that only one item is selected now.
expectedCountLabel =
await PluralStringProxyImpl.getInstance().getPluralString(
'movePasswordsToAccount', 1);
countLabel =
moveMultipleDialog.$$('#movingPasswordsCountLabel').textContent.trim();
expectEquals(expectedCountLabel, countLabel);
});
}); });
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