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

[FluentWizard] Fix ValueChanged never trigerred in FluentWizard #1538

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@inject IDialogService DialogService
@inject IDialogService DialogService

<style>
#customized-wizard li[status="current"] > div {
Expand Down Expand Up @@ -93,4 +93,4 @@
@code
{
int Value = 0;
}
}
1 change: 1 addition & 0 deletions src/Core/Components/Wizard/FluentWizard.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ protected virtual async Task OnPreviousHandlerAsync(MouseEventArgs e)
protected virtual async Task<FluentWizardStepChangeEventArgs> OnStepChangeHandlerAsync(int targetIndex)
{
var stepChangeArgs = new FluentWizardStepChangeEventArgs(targetIndex, _steps[targetIndex].Label);
await ValueChanged.InvokeAsync(targetIndex);
return await OnStepChangeHandlerAsync(stepChangeArgs);
}

Expand Down
33 changes: 31 additions & 2 deletions tests/Core/Wizard/FluentWizardTests.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@using Xunit;
@using Xunit;
@inherits TestContext
@code
{
Expand Down Expand Up @@ -138,6 +138,35 @@
cut.FindAll("li")[1].ToMarkup().Contains("status=\"current\"");
}

[Fact]
public void FluentWizard_NavigateWithBindedValue()
{
int stepIndex = 0;

// Arrange
var cut = Render(@<FluentWizard @bind-Value="@stepIndex">
<Steps>
<FluentWizardStep Label="Step1" Summary="Summary 1">
Content 1
</FluentWizardStep>
<FluentWizardStep Label="Step2" Summary="Summary 2">
Content 2
</FluentWizardStep>
<FluentWizardStep Label="Step3" Summary="Summary 3">
Content 3
</FluentWizardStep>
</Steps>
</FluentWizard>
);

var nextButton = cut.Find("fluent-button[appearance='accent']");
nextButton.Click();

// Assert
cut.FindAll("li")[1].ToMarkup().Contains("status=\"current\"");
Assert.Equal(1, stepIndex);
}

[Fact]
public void FluentWizard_NavigateWithDisabled()
{
Expand Down Expand Up @@ -228,4 +257,4 @@
return $"{args.Index} - {(args.Active ? "Active" : "Inactive")}";
}
}
}
}
Loading