Skip to content

Commit

Permalink
Settings: Migrate password section test to TypeScript
Browse files Browse the repository at this point in the history
Bug: 1263610
Change-Id: I3287d9be4c47f1772fac2ed383eae0e2afc8ab21
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3541703
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/main@{#984945}
  • Loading branch information
rbpotter authored and Chromium LUCI CQ committed Mar 24, 2022
1 parent f4e8710 commit e9e69a2
Show file tree
Hide file tree
Showing 6 changed files with 373 additions and 378 deletions.
Expand Up @@ -16,6 +16,7 @@ import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js';
import 'chrome://resources/cr_elements/shared_style_css.m.js';
import './avatar_icon.js';

import {CrCheckboxElement} from 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.m.js';
import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js';
import {assert} from 'chrome://resources/js/assert.m.js';
import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js';
Expand All @@ -30,15 +31,19 @@ import {getTemplate} from './password_remove_dialog.html.js';
export type PasswordRemoveDialogPasswordsRemovedEvent =
CustomEvent<{removedFromAccount: boolean, removedFromDevice: boolean}>;

interface PasswordRemoveDialogElement {
export interface PasswordRemoveDialogElement {
$: {
dialog: CrDialogElement,
removeButton: HTMLElement,
removeFromAccountCheckbox: CrCheckboxElement,
removeFromDeviceCheckbox: CrCheckboxElement,
};
}

const PasswordRemoveDialogElementBase = I18nMixin(PolymerElement);

class PasswordRemoveDialogElement extends PasswordRemoveDialogElementBase {
export class PasswordRemoveDialogElement extends
PasswordRemoveDialogElementBase {
static get is() {
return 'password-remove-dialog';
}
Expand Down Expand Up @@ -135,5 +140,11 @@ class PasswordRemoveDialogElement extends PasswordRemoveDialogElementBase {
}
}

declare global {
interface HTMLElementTagNameMap {
'password-remove-dialog': PasswordRemoveDialogElement;
}
}

customElements.define(
PasswordRemoveDialogElement.is, PasswordRemoveDialogElement);
Expand Up @@ -55,7 +55,11 @@ export interface PasswordsListHandlerElement {
$: {
copyToast: CrToastElement,
menu: CrActionMenuElement,
menuCopyPassword: HTMLElement,
menuEditPassword: HTMLElement,
menuMovePasswordToAccount: HTMLElement,
menuRemovePassword: HTMLElement,
removalNotification: HTMLElement,
removalToast: CrToastElement,
};
}
Expand Down
Expand Up @@ -31,13 +31,14 @@ import './passwords_shared_css.js';
import './avatar_icon.js';

import {CrActionMenuElement} from 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.js';
import {CrLinkRowElement} from 'chrome://resources/cr_elements/cr_link_row/cr_link_row.js';
import {assert, assertNotReached} from 'chrome://resources/js/assert.m.js';
import {focusWithoutInk} from 'chrome://resources/js/cr/ui/focus_without_ink.m.js';
import {I18nMixin} from 'chrome://resources/js/i18n_mixin.js';
import {getDeepActiveElement} from 'chrome://resources/js/util.m.js';
import {WebUIListenerMixin} from 'chrome://resources/js/web_ui_listener_mixin.js';
import {IronA11yAnnouncer} from 'chrome://resources/polymer/v3_0/iron-a11y-announcer/iron-a11y-announcer.js';
import {afterNextRender, DomRepeatEvent, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {afterNextRender, DomRepeat, DomRepeatEvent, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';

import {GlobalScrollTargetMixin} from '../global_scroll_target_mixin.js';
import {HatsBrowserProxyImpl, TrustSafetyInteraction} from '../hats_browser_proxy.js';
Expand All @@ -56,7 +57,7 @@ import {MergePasswordsStoreCopiesMixin} from './merge_passwords_store_copies_mix
import {MultiStoreExceptionEntry} from './multi_store_exception_entry.js';
import {MultiStorePasswordUiEntry} from './multi_store_password_ui_entry.js';
import {PasswordCheckMixin} from './password_check_mixin.js';
import {AddCredentialFromSettingsUserInteractions} from './password_edit_dialog.js';
import {AddCredentialFromSettingsUserInteractions, PasswordEditDialogElement} from './password_edit_dialog.js';
import {PasswordCheckReferrer, PasswordExceptionListChangedListener, PasswordManagerImpl, PasswordManagerProxy} from './password_manager_proxy.js';
import {PasswordsListHandlerElement} from './passwords_list_handler.js';
import {getTemplate} from './passwords_section.html.js';
Expand All @@ -78,8 +79,31 @@ type FocusConfig = Map<string, string|(() => void)>;

export interface PasswordsSectionElement {
$: {
accountEmail: HTMLElement,
accountStorageButtonsContainer: HTMLElement,
accountStorageOptInBody: HTMLElement,
accountStorageOptOutBody: HTMLElement,
addPasswordDialog: PasswordEditDialogElement,
checkPasswordLeakCount: HTMLElement,
checkPasswordLeakDescription: HTMLElement,
checkPasswordWarningIcon: HTMLElement,
checkPasswordsBannerContainer: HTMLElement,
checkPasswordsButtonRow: HTMLElement,
checkPasswordsLinkRow: HTMLElement,
devicePasswordsLink: HTMLElement,
exportImportMenu: CrActionMenuElement,
manageLink: HTMLElement,
menuEditPassword: HTMLElement,
menuExportPassword: HTMLElement,
noExceptionsLabel: HTMLElement,
noPasswordsLabel: HTMLElement,
optInToAccountStorageButton: HTMLElement,
optOutOfAccountStorageButton: HTMLElement,
passwordExceptionsList: HTMLElement,
passwordList: DomRepeat,
passwordsListHandler: PasswordsListHandlerElement,
savedPasswordsHeaders: HTMLElement,
trustedVaultBanner: CrLinkRowElement,
};
}

Expand Down
1 change: 1 addition & 0 deletions chrome/browser/resources/settings/lazy_load.ts
Expand Up @@ -88,6 +88,7 @@ export {PasswordListItemElement} from './autofill_page/password_list_item.js';
export {PasswordMoveMultiplePasswordsToAccountDialogElement} from './autofill_page/password_move_multiple_passwords_to_account_dialog.js';
export {PasswordMoveToAccountDialogElement} from './autofill_page/password_move_to_account_dialog.js';
export {SettingsPasswordRemoveConfirmationDialogElement} from './autofill_page/password_remove_confirmation_dialog.js';
export {PasswordRemoveDialogElement} from './autofill_page/password_remove_dialog.js';
export {PasswordsDeviceSectionElement} from './autofill_page/passwords_device_section.js';
export {PasswordsExportDialogElement} from './autofill_page/passwords_export_dialog.js';
export {PasswordsSectionElement} from './autofill_page/passwords_section.js';
Expand Down
2 changes: 1 addition & 1 deletion chrome/test/data/webui/settings/BUILD.gn
Expand Up @@ -73,7 +73,7 @@ non_preprocessed_files = [
"passwords_and_autofill_fake_data.ts",
"passwords_device_section_test.ts",
"passwords_export_test.ts",
"passwords_section_test.js",
"passwords_section_test.ts",
"payments_section_interactive_test.ts",
"payments_section_test.ts",
"people_page_sync_controls_test.ts",
Expand Down

0 comments on commit e9e69a2

Please sign in to comment.