Skip to content

MudMenu: Improve Encapsulation, public API is now Async#8634

Merged
ScarletKuro merged 7 commits intoMudBlazor:devfrom
ScarletKuro:Menu_improve
Apr 12, 2024
Merged

MudMenu: Improve Encapsulation, public API is now Async#8634
ScarletKuro merged 7 commits intoMudBlazor:devfrom
ScarletKuro:Menu_improve

Conversation

@ScarletKuro
Copy link
Member

@ScarletKuro ScarletKuro commented Apr 10, 2024

Description

Fixes encapsulation
I do not think that MouseEnter and MouseLeave should be public.

Activate(object activator, MouseEventArgs args)

was changed to explicit IActivatable implementation as I also do not think this API should be visible.

Activate(object activator, TouchEventArgs args)

was removed, since IActivatable doesn't have such definition.

I also do not understand why PopoverStyle is public?
If it can be changed outside, then it should be declared as Blazor Parameter, if not and it's only used for internal styling, then it shouldn't be visible.

UriHelper and JsApiService were changed to protected, as it also shouldn't be used outside.
OnClickHandler renamed to OnClickHandlerAsync

ToggleMenu, CloseMenu, OpenMenu are now async, since they call EventCallback

Summarize:

  1. MouseEnter, MouseLeave are private now.
  2. Activate(object activator, MouseEventArgs args) is explicit now.
  3. Activate(object activator, TouchEventArgs args) removed.
  4. PopoverStyle is private now.
  5. UriHelper, JsApiService changed from public to protected.
  6. OnClickHandler -> OnClickHandlerAsync.
  7. ToggleMenu, CloseMenu, OpenMenu are now async.

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@ScarletKuro ScarletKuro requested a review from henon April 10, 2024 22:35
@github-actions github-actions bot added breaking change This change will require consumer code updates PR: needs review labels Apr 10, 2024
@ScarletKuro
Copy link
Member Author

We also probably should just make IsOpen as two way bindable, because there is IsOpenChanged and IsOpen but it's not a parameter. But if we should, then I'd prefer to do it as separate PR after OnClickHandlerAsync

@ScarletKuro
Copy link
Member Author

This tests are weird
changing async void MouseLeaveAsync to async Task MouseLeaveAsync makes MenuMouseLeave_MenuMouseEnter_CheckOpen() test to fail, I added ConfigureAwait to delay and the tests passes but MenuMouseLeave_CheckClosed fails, adding InvokeAsync make that test pass, but the CheckOpen fails again.

@ScarletKuro ScarletKuro changed the title MudMenu: Improve Encapsulation MudMenu: Improve Encapsulation, public API is now Async Apr 11, 2024
@codecov
Copy link

codecov bot commented Apr 11, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 90.08%. Comparing base (28bc599) to head (6141b24).
Report is 38 commits behind head on dev.

Files Patch % Lines
src/MudBlazor/Components/Menu/MudMenu.razor.cs 71.42% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #8634      +/-   ##
==========================================
+ Coverage   89.82%   90.08%   +0.25%     
==========================================
  Files         412      418       +6     
  Lines       11878    12006     +128     
  Branches     2364     2366       +2     
==========================================
+ Hits        10670    10816     +146     
+ Misses        681      658      -23     
- Partials      527      532       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@henon henon added API change Modifies the public API surface v7 and removed PR: needs review labels Apr 12, 2024
@ScarletKuro
Copy link
Member Author

Added to v7.0.0 Migration Guide #8447

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API change Modifies the public API surface breaking change This change will require consumer code updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants