зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1847815 - Allow embedders of the migration-wizard to override the variant pref via an attribute. r=kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D185707
This commit is contained in:
Родитель
2e33b5ae6b
Коммит
1b8af1c366
|
@ -534,7 +534,16 @@ export class MigrationWizard extends HTMLElement {
|
|||
);
|
||||
|
||||
let details = this.#shadowRoot.querySelector("details");
|
||||
selectionPage.toggleAttribute("show-import-all", state.showImportAll);
|
||||
|
||||
if (this.hasAttribute("force-show-import-all")) {
|
||||
selectionPage.toggleAttribute(
|
||||
"show-import-all",
|
||||
this.getAttribute("force-show-import-all") == "true"
|
||||
);
|
||||
} else {
|
||||
selectionPage.toggleAttribute("show-import-all", state.showImportAll);
|
||||
}
|
||||
|
||||
details.open = !state.showImportAll;
|
||||
|
||||
this.#expandedDetails = false;
|
||||
|
|
|
@ -1366,6 +1366,59 @@
|
|||
errorText = gShadowRoot.querySelector("#file-import-error-message").textContent;
|
||||
is(errorText, "");
|
||||
});
|
||||
|
||||
/**
|
||||
* Tests that the variant of the wizard can be forced via
|
||||
* attributes on the migration-wizard element.
|
||||
*/
|
||||
add_task(async function force_show_import_all() {
|
||||
gWiz.setState({
|
||||
page: MigrationWizardConstants.PAGES.SELECTION,
|
||||
migrators: MIGRATOR_PROFILE_INSTANCES,
|
||||
showImportAll: true,
|
||||
});
|
||||
|
||||
let selectionPage = gShadowRoot.querySelector("div[name='page-selection']");
|
||||
ok(
|
||||
selectionPage.hasAttribute("show-import-all"),
|
||||
"Should be paying attention to showImportAll=true on state object"
|
||||
);
|
||||
|
||||
gWiz.setState({
|
||||
page: MigrationWizardConstants.PAGES.SELECTION,
|
||||
migrators: MIGRATOR_PROFILE_INSTANCES,
|
||||
showImportAll: false,
|
||||
});
|
||||
|
||||
ok(
|
||||
!selectionPage.hasAttribute("show-import-all"),
|
||||
"Should be paying attention to showImportAll=false on state object"
|
||||
);
|
||||
|
||||
gWiz.setAttribute("force-show-import-all", "false");
|
||||
gWiz.setState({
|
||||
page: MigrationWizardConstants.PAGES.SELECTION,
|
||||
migrators: MIGRATOR_PROFILE_INSTANCES,
|
||||
showImportAll: true,
|
||||
});
|
||||
ok(
|
||||
!selectionPage.hasAttribute("show-import-all"),
|
||||
"Should be paying attention to force-show-import-all=false on DOM node"
|
||||
);
|
||||
|
||||
gWiz.setAttribute("force-show-import-all", "true");
|
||||
gWiz.setState({
|
||||
page: MigrationWizardConstants.PAGES.SELECTION,
|
||||
migrators: MIGRATOR_PROFILE_INSTANCES,
|
||||
showImportAll: false,
|
||||
});
|
||||
ok(
|
||||
selectionPage.hasAttribute("show-import-all"),
|
||||
"Should be paying attention to force-show-import-all=true on DOM node"
|
||||
);
|
||||
|
||||
gWiz.removeAttribute("force-show-import-all");
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
Загрузка…
Ссылка в новой задаче