Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Save button in password change form #5256

Merged
merged 6 commits into from
Nov 19, 2024
Merged

Conversation

Cloud11PL
Copy link
Member

@Cloud11PL Cloud11PL commented Nov 15, 2024

It fixes an issue that prevented <form /> from rendering.

What type of PR is this?

  • 💅 Refactor
  • 🌟 Feature
  • 🔥 Bug Fix
  • 🔩 Maintenance
  • 🛠 Workflow CI/CD changes

Related Issues or Documents

  • closes #

Usage Instructions, Screenshots, Recordings

Have you written tests?

  • Yes!
  • No... here is why: Writing tests are mandatory, please replace this text with why test are not included in this PR

[Optional] Description

Copy link

changeset-bot bot commented Nov 15, 2024

🦋 Changeset detected

Latest commit: b507160

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
saleor-dashboard Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot temporarily deployed to pr-5256 November 15, 2024 12:13 Destroyed
@Cloud11PL Cloud11PL marked this pull request as ready for review November 15, 2024 12:16
@Cloud11PL Cloud11PL requested a review from a team as a code owner November 15, 2024 12:16
poulch
poulch previously approved these changes Nov 15, 2024
fireEvent.click(submitButton);

// Assert
expect(defaultProps.onSubmit).toHaveBeenCalled();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: You could also check arguments passed to onsubmit function

@Cloud11PL Cloud11PL requested a review from poulch November 15, 2024 12:36
@github-actions github-actions bot temporarily deployed to pr-5256 November 15, 2024 12:38 Destroyed
Comment on lines +27 to +33
it("renders the form", () => {
// Arrange & Act
render(<StaffPasswordResetDialog {...defaultProps} />);

// Assert
expect(screen.getByRole("form")).toBeInTheDocument();
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any sense testing just the rendering part? you don't test any interaction here, as if it was static content

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bug here was that the "form" wasn't rendered at all (Modal rendered it as div)

/>
<Form initial={initialForm} onSubmit={onSubmit} role="form">
{({ change, data }) => (
<Box display="flex" flexDirection="column" gap={4}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: if you see that big components and you touch them significantly, try next time break them down into smaller ones (context-wise), so perhaps you can test them

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted, although here there were basically 2 inputs and a button 😄 I know git shows a big change but I only moved the form inside modal content.

@github-actions github-actions bot temporarily deployed to pr-5256 November 19, 2024 10:09 Destroyed
@Cloud11PL Cloud11PL merged commit ef5457c into main Nov 19, 2024
14 checks passed
@Cloud11PL Cloud11PL deleted the MERX-1271-password-change-fix branch November 19, 2024 10:30
poulch added a commit that referenced this pull request Nov 19, 2024
* fix Save button in password change form

* fix type

* change header placement

* expect onSubmit to be called with data

---------

Co-authored-by: Paweł Chyła <chyla1988@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants