mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
Update Storybook with initialLoginEmail
This commit is contained in:
@@ -4,7 +4,7 @@ import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
|
|||||||
import { ActivatedRoute, Params } from "@angular/router";
|
import { ActivatedRoute, Params } from "@angular/router";
|
||||||
import { RouterTestingModule } from "@angular/router/testing";
|
import { RouterTestingModule } from "@angular/router/testing";
|
||||||
import { Meta, StoryObj, applicationConfig, moduleMetadata } from "@storybook/angular";
|
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 { AccountApiService } from "@bitwarden/common/auth/abstractions/account-api.service";
|
||||||
import { ClientType } from "@bitwarden/common/enums";
|
import { ClientType } from "@bitwarden/common/enums";
|
||||||
@@ -30,6 +30,7 @@ import {
|
|||||||
// FIXME: remove `/apps` import from `/libs`
|
// FIXME: remove `/apps` import from `/libs`
|
||||||
// eslint-disable-next-line import/no-restricted-paths
|
// eslint-disable-next-line import/no-restricted-paths
|
||||||
import { PreloadedEnglishI18nModule } from "../../../../../../apps/web/src/app/core/tests";
|
import { PreloadedEnglishI18nModule } from "../../../../../../apps/web/src/app/core/tests";
|
||||||
|
import { LoginEmailService } from "../../../common";
|
||||||
|
|
||||||
import { RegistrationStartComponent } from "./registration-start.component";
|
import { RegistrationStartComponent } from "./registration-start.component";
|
||||||
|
|
||||||
@@ -43,6 +44,7 @@ const decorators = (options: {
|
|||||||
queryParams?: Params;
|
queryParams?: Params;
|
||||||
clientType?: ClientType;
|
clientType?: ClientType;
|
||||||
defaultRegion?: Region;
|
defaultRegion?: Region;
|
||||||
|
initialLoginEmail?: string;
|
||||||
}) => {
|
}) => {
|
||||||
return [
|
return [
|
||||||
moduleMetadata({
|
moduleMetadata({
|
||||||
@@ -88,6 +90,12 @@ const decorators = (options: {
|
|||||||
getClientType: () => options.clientType || ClientType.Web,
|
getClientType: () => options.clientType || ClientType.Web,
|
||||||
} as Partial<PlatformUtilsService>,
|
} as Partial<PlatformUtilsService>,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
provide: LoginEmailService,
|
||||||
|
useValue: {
|
||||||
|
loginEmail$: new BehaviorSubject<string | null>(options.initialLoginEmail || null),
|
||||||
|
} as Partial<LoginEmailService>,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
provide: ToastService,
|
provide: ToastService,
|
||||||
useValue: {
|
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 = {
|
export const DesktopUSRegionExample: Story = {
|
||||||
render: (args) => ({
|
render: (args) => ({
|
||||||
props: args,
|
props: args,
|
||||||
|
|||||||
Reference in New Issue
Block a user