MudNavGroup: Fix NavigationContext not updating on Expanded#9101
Merged
ScarletKuro merged 2 commits intoMudBlazor:devfrom Jun 3, 2024
Merged
MudNavGroup: Fix NavigationContext not updating on Expanded#9101ScarletKuro merged 2 commits intoMudBlazor:devfrom
ScarletKuro merged 2 commits intoMudBlazor:devfrom
Conversation
Member
Author
|
Adding @igotinfected for review too. Also let me know if we need test for this case. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #9101 +/- ##
==========================================
+ Coverage 89.82% 90.65% +0.82%
==========================================
Files 412 398 -14
Lines 11878 12381 +503
Branches 2364 2406 +42
==========================================
+ Hits 10670 11224 +554
+ Misses 681 620 -61
- Partials 527 537 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
Thanks for the fix, and sorry for the regression! I suggest adding this as a test: /// <summary>
/// NavGroup should expand and collapse via Expanded binding.
/// </summary>
[Test]
public async Task NavGroup_should_expand_via_Expanded_binding()
{
var comp = Context.RenderComponent<NavGroupWithExpandedBindingTest>();
GetExpandedState().Should().BeFalse();
await comp.InvokeAsync(() => comp.Find("#navgroup-switch").Change(true));
GetExpandedState().Should().BeTrue();
await comp.InvokeAsync(() => comp.Find("#navgroup-switch").Change(false));
GetExpandedState().Should().BeFalse();
return;
bool GetExpandedState() => comp.FindComponent<MudCollapse>().Instance.Expanded;
}With this as test component (covering the user's test case): <MudNavGroup Icon="@Icons.Material.Filled.ManageAccounts"
Title="Users"
Expanded="@_expanded">
<MudNavLink Href="profile"
Match="NavLinkMatch.Prefix"
Icon="@Icons.Material.Filled.Person">
Profile
</MudNavLink>
</MudNavGroup>
<MudSwitch T="bool"
id="navgroup-switch"
@bind-Value="@_expanded"
Label="Expand navigation group" />
@code {
private bool _expanded;
} |
Member
Author
|
Thx for the test. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes issue mentioned here: #8976 (comment)
Regression PR: #8684
How Has This Been Tested?
Visually, added bUnit test.
Type of Changes
Checklist
dev).