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

test(module: drawer): Test, refactor and document Drawer #2833

Merged
merged 5 commits into from
Oct 23, 2022

Conversation

kooliokey
Copy link
Contributor

@kooliokey kooliokey commented Oct 23, 2022

Bug fix:

  • Content string would never render (wrong condition checked)

Refactors:

  • Remove this.
  • Remove code that didn't do anything helpful from my testing - will comment on inline
  • Moved code to make it more obvious only one condition can exist at a time - will comment on inline

Documentation site update to match available parameters

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • Bundle size optimization
  • Performance optimization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

#2644

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English Fix bug where Content wouldn't render in Drawer if it was a string and not RenderFragment
🇨🇳 Chinese 修复如果内容是字符串而不是 RenderFragment,则内容不会在 Drawer 中呈现的错误

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Changelog is provided or not needed

kooliokey added 3 commits October 23, 2022 00:16
… be null or empty the drawer closes with or without this code in place.
@github-actions
Copy link

github-actions bot commented Oct 23, 2022


base.OnInitialized();
}

protected override void OnParametersSet()
{
this.SetClass();
if (string.IsNullOrEmpty(Placement) && Placement != _originalPlacement)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block and line 448 block that was removed didn't do anything when Placement was null or empty string. I tested with a without it and it behaved the same both ways.

I checked when it was added to the repo and it was from the start and also moved in a refactor to fix a bug. I double checked that bug and it is still fixed with this removed. It was related to multiple drawers open.

@@ -502,37 +482,16 @@ private async Task HandleClose(bool isChangeByParamater = false)
}
}

private void CalcAnimation()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this to be inline with where it was called to make it obvious only the width or height transition could exist at once due to it being dependent on Placement's value. It is moved to line 490 below

@@ -22,6 +22,7 @@ public AntDesignTestBase(bool useMoq = false)
//Needed for Tests using Overlay
Services.AddScoped<AntDesign.JsInterop.DomEventService>(sp => new TestDomEventService(Context.JSInterop.JSRuntime, MockedDomEventListener));
JSInterop.SetupVoid(JSInteropConstants.OverlayComponentHelper.DeleteOverlayFromContainer, _ => true);
JSInterop.Mode = JSRuntimeMode.Strict;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this so even if a test changes it, all other tests still have it set to the default Strict. Not 100% sure the lifetime of this service but figured it was a good precaution.

@codecov
Copy link

codecov bot commented Oct 23, 2022

Codecov Report

Base: 43.08% // Head: 43.76% // Increases project coverage by +0.67% 🎉

Coverage data is based on head (e3d3e40) compared to base (f9c5f5c).
Patch coverage: 86.20% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2833      +/-   ##
==========================================
+ Coverage   43.08%   43.76%   +0.67%     
==========================================
  Files         544      544              
  Lines       25768    25743      -25     
  Branches      260      260              
==========================================
+ Hits        11103    11267     +164     
+ Misses      14625    14436     -189     
  Partials       40       40              
Impacted Files Coverage Δ
components/drawer/Drawer.razor.cs 90.19% <85.71%> (+90.19%) ⬆️
components/drawer/Drawer.razor 100.00% <100.00%> (+100.00%) ⬆️
components/date-picker/RangePicker.razor.cs 53.79% <0.00%> (+0.33%) ⬆️
components/core/Component/Overlay/Overlay.razor.cs 76.74% <0.00%> (+1.16%) ⬆️
components/core/JsInterop/JSInteropConstants.cs 32.80% <0.00%> (+3.19%) ⬆️
components/core/ComponentStatus.cs 50.00% <0.00%> (+50.00%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@kooliokey
Copy link
Contributor Author

Codecov Report

Base: 43.08% // Head: 42.38% // Decreases project coverage by -0.70% ⚠️

Coverage data is based on head (7d4009f) compared to base (f9c5f5c).
Patch coverage: 86.20% of modified lines in pull request are covered.

Additional details and impacted files
☔ View full report at Codecov. 📢 Do you have feedback about the report comment? Let us know in this issue.

How did coverage go down? 😢

@ElderJames
Copy link
Member

Yes, that's a weird statistic. It feels different than the statistics of the master branch

private string _zIndexStyle = "";

private void TriggerPlacementChangeCycleOnce()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zxyao145 Please check if this method is useless.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this method will only be triggered when the Placement changes (line 394).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zxyao145 , please help to confirm whether there is any problem after deletion.

@ElderJames ElderJames merged commit d58bcc2 into ant-design-blazor:master Oct 23, 2022
@ElderJames ElderJames mentioned this pull request Oct 28, 2022
62 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants