1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-23 21:31:29 +01:00

Update Storybook with initialLoginEmail

This commit is contained in:
Alec Rippberger 2024-10-15 10:59:52 -05:00
parent 72f07fef55
commit 31f65ec463
No known key found for this signature in database
GPG Key ID: 9DD8DA583B28154A

View File

@ -4,7 +4,7 @@ import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { ActivatedRoute, Params } from "@angular/router";
import { RouterTestingModule } from "@angular/router/testing";
import { Meta, StoryObj, applicationConfig, moduleMetadata } from "@storybook/angular";
import { of } from "rxjs";
import { of, BehaviorSubject } from "rxjs";
import { AccountApiService } from "@bitwarden/common/auth/abstractions/account-api.service";
import { ClientType } from "@bitwarden/common/enums";
@ -30,6 +30,7 @@ import {
// FIXME: remove `/apps` import from `/libs`
// eslint-disable-next-line import/no-restricted-paths
import { PreloadedEnglishI18nModule } from "../../../../../../apps/web/src/app/core/tests";
import { LoginEmailService } from "../../../common";
import { RegistrationStartComponent } from "./registration-start.component";
@ -43,6 +44,7 @@ const decorators = (options: {
queryParams?: Params;
clientType?: ClientType;
defaultRegion?: Region;
initialLoginEmail?: string;
}) => {
return [
moduleMetadata({
@ -88,6 +90,12 @@ const decorators = (options: {
getClientType: () => options.clientType || ClientType.Web,
} as Partial<PlatformUtilsService>,
},
{
provide: LoginEmailService,
useValue: {
loginEmail$: new BehaviorSubject<string | null>(options.initialLoginEmail || null),
} as Partial<LoginEmailService>,
},
{
provide: ToastService,
useValue: {
@ -149,6 +157,21 @@ export const WebUSRegionQueryParamsExample: Story = {
}),
};
export const WebUSRegionWithInitialLoginEmailExample: Story = {
render: (args) => ({
props: args,
template: `
<auth-registration-start></auth-registration-start>
`,
}),
decorators: decorators({
clientType: ClientType.Web,
queryParams: {},
defaultRegion: Region.US,
initialLoginEmail: "example@bitwarden.com",
}),
};
export const DesktopUSRegionExample: Story = {
render: (args) => ({
props: args,