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

[Wizard] Fix validation when @bind-Value is set #2364

Merged

Conversation

Akwaduk
Copy link
Contributor

@Akwaduk Akwaduk commented Jul 11, 2024

Pull Request

📖 Description

Update the Wizard component to honor the FluentFormEdit validation components when @bind-Value is set.

🎫 Issues

When @bind-Value is set on the Wizard Component the next button will work even if there is a FluentFormEdit component within the FluentWizardStep component and the model is invalid for that WizardStep component.

👩‍💻 Reviewer Notes

📑 Test Plan

  1. Update a test for FluentWizard_EditForm_EditContextIsInValid_OnNext a @bind-Value to an integer, assert this value will not change to a new value once the next button is clicked.
  2. Run the test; expect failure.
  3. Update the component to only run the ValueChanged event for Value when it is valid and not cancelled.
  4. Run the text; expect success.

✅ Checklist

General

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

Component-specific

  • I have added a new component
  • I have added Unit Tests for my new compontent
  • I have modified an existing component
  • I have validated the Unit Tests for an existing component

fix: validation stops working when @bind-Value is set on the FluentWizard component to an integer property on the page

Adding test to validate that index does not change on next within wizard component
@Akwaduk Akwaduk force-pushed the dev-wizard-bound-value-breaks-validation branch from 801bd38 to 34ffebc Compare July 11, 2024 18:47
src/Core/Components/Wizard/FluentWizard.razor.cs Outdated Show resolved Hide resolved
tests/Core/Wizard/FluentWizardTests.razor Outdated Show resolved Hide resolved
tests/Core/Wizard/FluentWizardTests.razor Outdated Show resolved Hide resolved
@dvoituron
Copy link
Collaborator

Thanks for this PR. Good catch and good work :-)
Indeed, this is a case that is not covered by the code.

@Akwaduk
Copy link
Contributor Author

Akwaduk commented Jul 16, 2024 via email

@dvoituron dvoituron merged commit f8998c7 into microsoft:dev Jul 16, 2024
4 checks passed
@vnbaaij vnbaaij added this to the v4.9.2 milestone Jul 19, 2024
@vnbaaij vnbaaij changed the title Fix validation when @bind-Value is set for FluentWizard component [Wizard] Fix validation when @bind-Value is set Jul 19, 2024
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.

4 participants