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

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

Merged
merged 7 commits into from
Apr 12, 2024

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
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
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 API that needs approval v7 New major MudBlazor version and removed PR: needs review labels Apr 12, 2024
@ScarletKuro
Copy link
Member Author

Added to v7.0.0 Migration Guide #8447

@ScarletKuro ScarletKuro merged commit d0de62e into MudBlazor:dev Apr 12, 2024
3 of 4 checks passed
@ScarletKuro ScarletKuro deleted the Menu_improve branch April 12, 2024 20:18
biegehydra pushed a commit to biegehydra/MudBlazor that referenced this pull request Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API change API that needs approval breaking change v7 New major MudBlazor version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants