Skip to content

[Wizard] Add the ability to invoke OnFinish #3648

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

Merged

Conversation

StevenRasmussen
Copy link
Contributor

Pull Request

📖 Description

The FluentWizard currently allows you to customize the ButtonTemplate which is great! And there is a public method exposed (GoToStepAsync) which allows you to essentially call the Next and Previous buttons manually from your custom buttons. However, there is no way to call the OnFinish logic from a custom button. This updates the component to expose a new method called FinishAsync with an optional parameter to validate the form contexts (which I modeled after the GoToStepAsync method).

I am not sure if/how you would like me to add unit tests for this. There are not any unit tests currently for the 'Customized' ButtonTemplate portion of the FluentWizard. I ran all the current unit tests to ensure that nothing broke. If you would like a unit test added, please specify what the unit test should be doing so that I know how you would like it written and what it would be testing.

👩‍💻 Reviewer Notes

I have updated the demo site page to include a new Finish button on the "Customized Wizard" area.

✅ 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 component
  • I have modified an existing component
  • I have validated the Unit Tests for an existing component

@dvoituron
Copy link
Collaborator

That could be a good additional method.

For the Unit Tests, you need take inspiration from FluentWizard_EditForm_EditContextIsInValid_OnNext, FluentWizard_EditForm_EditContextIsInValid_OnFinish(), FluentWizard_EditForm_EditContextIsValid and to create a new test including the ButtonTemplate

@StevenRasmussen
Copy link
Contributor Author

@dvoituron - I've added the following 3 unit tests as requested: FluentWizard_CustomizedButtonTemplate_EditForm_EditContextIsInValid_OnNext, FluentWizard_CustomizedButtonTemplate_EditForm_EditContextIsInValid_OnFinish and FluentWizard_CustomizedButtonTemplate_EditForm_EditContextIsValid.

@vnbaaij vnbaaij changed the title Added the ability to invoke the 'OnFinish' for the FluentWizard [Wizard] Add the ability to invoke OnFinish Apr 13, 2025
@vnbaaij vnbaaij added this to the v4.11.9 milestone Apr 13, 2025
@dvoituron dvoituron enabled auto-merge (squash) April 13, 2025 20:39
@dvoituron dvoituron merged commit 46de517 into microsoft:dev Apr 13, 2025
4 checks passed
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