keycloak_theme/stories/login/pages/LoginUpdateProfile.stories.tsx

42 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-04-20 05:41:34 +02:00
import React from "react";
2024-06-03 00:11:19 +02:00
import type { Meta, StoryObj } from "@storybook/react";
2024-06-09 11:53:25 +02:00
import { createKcPageStory } from "../KcPageStory";
2023-04-20 05:41:34 +02:00
2024-06-09 11:53:25 +02:00
const { KcPageStory } = createKcPageStory({ pageId: "login-update-profile.ftl" });
2023-04-20 05:41:34 +02:00
2024-06-03 00:11:19 +02:00
const meta = {
2024-06-06 07:28:34 +02:00
title: "login/login-update-profile.ftl",
2024-06-09 11:53:25 +02:00
component: KcPageStory
} satisfies Meta<typeof KcPageStory>;
2023-04-20 05:41:34 +02:00
export default meta;
2024-06-03 00:11:19 +02:00
type Story = StoryObj<typeof meta>;
export const Default: Story = {
2024-06-09 11:53:25 +02:00
render: () => <KcPageStory />
2024-06-03 00:11:19 +02:00
};
2024-10-19 17:24:29 -04:00
/**
* WithProfileError:
* - Purpose: Tests when an error occurs in one or more profile fields (e.g., invalid email format).
* - Scenario: The component displays error messages next to the affected fields.
* - Key Aspect: Ensures the profile fields show error messages when validation fails.
*/
export const WithProfileError: Story = {
render: () => (
<KcPageStory
kcContext={{
url: {
loginAction: "/mock-login-action"
},
messagesPerField: {
existsError: (field: string) => field === "email",
get: () => "Invalid email format"
},
isAppInitiatedAction: false
}}
/>
)
};