Skip to content

Commit

Permalink
fix: remove memberid login in itemLogin component (#925)
Browse files Browse the repository at this point in the history
  • Loading branch information
spaenleh committed Jul 3, 2024
1 parent 64c8bdf commit 3c5bf8e
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 291 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
"react-dnd-html5-backend": "16.0.1",
"react-quill": "2.0.0",
"react-rnd": "10.4.11",
"react-text-mask": "5.5.0",
"uuid": "10.0.0",
"vitest": "1.6.0"
},
Expand Down
1 change: 0 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const SETTINGS = {
},
SIGN_IN_MODE: {
PSEUDONYM: 'pseudonym',
MEMBER_ID: 'memberId',
},
},
};
Expand Down
5 changes: 0 additions & 5 deletions src/itemLogin/ItemLoginAuthorization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export type ItemLoginAuthorizationProps = {
usernameInputId?: string;
signInButtonId?: string;
passwordInputId?: string;
modeSelectId?: string;
ForbiddenContent?: ReactElement;
};

Expand All @@ -41,11 +40,9 @@ const ItemLoginAuthorization =
itemId,
signIn,
Error: ErrorComponent,
memberIdInputId,
usernameInputId,
signInButtonId,
passwordInputId,
modeSelectId,
ForbiddenContent = <ForbiddenText />,
}: ItemLoginAuthorizationProps) =>
(ChildComponent: typeof React.Component | (() => JSX.Element)) => {
Expand Down Expand Up @@ -102,11 +99,9 @@ const ItemLoginAuthorization =
itemId={itemId}
signIn={signIn}
itemLoginSchemaType={itemLoginSchemaType}
memberIdInputId={memberIdInputId}
usernameInputId={usernameInputId}
signInButtonId={signInButtonId}
passwordInputId={passwordInputId}
modeSelectId={modeSelectId}
/>
);
}
Expand Down
59 changes: 23 additions & 36 deletions src/itemLogin/ItemLoginScreen.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ const meta: Meta<typeof ItemLoginScreen> = {
signIn: fn(),
},
argTypes: {
memberIdInputId: {
table: {
category: TABLE_CATEGORIES.SELECTORS,
},
},
modeSelectId: {
table: {
category: TABLE_CATEGORIES.SELECTORS,
},
},
passwordInputId: {
table: {
category: TABLE_CATEGORIES.SELECTORS,
Expand Down Expand Up @@ -54,45 +44,42 @@ export const ItemLoginUsernameAndPassword: Story = {
args: {
itemLoginSchemaType: ItemLoginSchemaType.UsernameAndPassword,
},
};
play: async ({ args, canvasElement }) => {
const canvas = within(canvasElement);

ItemLoginUsernameAndPassword.play = async ({ args, canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.type(
canvas.getByLabelText('Pseudonym'),
'email@provider.com',
);
await userEvent.type(canvas.getByLabelText('Password'), 'mypassword');
await userEvent.click(canvas.getByText('Sign In'));

await userEvent.type(
canvas.getByLabelText('Pseudonym'),
'email@provider.com',
);
await userEvent.type(canvas.getByLabelText('Password'), 'mypassword');
await userEvent.click(canvas.getByText('Sign In'));

expect(args.signIn).toHaveBeenCalled();
expect(args.signIn).toHaveBeenCalled();
},
};

export const ItemLoginUsername: Story = {
args: {
itemLoginSchemaType: ItemLoginSchemaType.Username,
},
};

ItemLoginUsername.play = async ({ args, canvasElement }) => {
const canvas = within(canvasElement);
play: async ({ args, canvasElement }) => {
const canvas = within(canvasElement);

await userEvent.type(
canvas.getByLabelText('Pseudonym'),
'email@provider.com',
);
await userEvent.click(canvas.getByText('Sign In'));
await userEvent.type(
canvas.getByLabelText('Pseudonym'),
'email@provider.com',
);
await userEvent.click(canvas.getByText('Sign In'));

expect(args.signIn).toHaveBeenCalled();
expect(args.signIn).toHaveBeenCalled();
},
};

export const Forbidden: Story = {
args: {},
};
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

Forbidden.play = async ({ canvasElement }) => {
const canvas = within(canvasElement);

await expect(canvas.getByText(FORBIDDEN_TEXT)).toBeInTheDocument();
await expect(canvas.getByText(FORBIDDEN_TEXT)).toBeInTheDocument();
},
};
Loading

0 comments on commit 3c5bf8e

Please sign in to comment.