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

Add OnClick parameter to BreadcrumbItem, Add Tests, Remove unusable code #2655

Merged
merged 9 commits into from
Sep 3, 2022

Conversation

kooliokey
Copy link
Contributor

@kooliokey kooliokey commented Sep 1, 2022

🤔 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

#2540 - OnClick
#2649 - Remove unusable code
#2644 - Test coverage
#2658 - Wrong HTML markup causing last separator to display

💡 Background and solution

  • A user discovered we document an OnClick parameter for BreadcrumbItem, but it was not implemented. Now it is. Also added to the demo.
  • Discovered when testing there is unreachable/unusable code for future features. Removed for now. Left public API alone but added comments about currently not being used.
  • Test coverage for Breadcrumb/Item
  • Update the markup of Breadcrumb/BreadcrumItem to match Ant.Design React

📝 Changelog

Language Changelog
🇺🇸 English Add OnClick parameter to BreadcrumbItem. Markup of Breadcrumb updated to match Ant.Design React. This could break custom CSS targeting this component's resulting markup.
🇨🇳 Chinese 将 OnClick 参数添加到 BreadcrumbItem. Breadcrumb 的标记已更新以匹配 Ant.Design React。这可能会破坏针对此组件生成标记的自定义 CSS

☑️ 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

… BreadcrumbItem. Remove unused and unreachable code until needed at a later date. Documented parameters not in use, but left to avoid breaking the existing public API.
@github-actions
Copy link

github-actions bot commented Sep 1, 2022

@codecov
Copy link

codecov bot commented Sep 1, 2022

Codecov Report

Merging #2655 (72f22eb) into master (3e9bb25) will increase coverage by 1.78%.
The diff coverage is 100.00%.

❗ Current head 72f22eb differs from pull request most recent head 81d66a7. Consider uploading reports for the commit 81d66a7 to get more accurate results

@@            Coverage Diff             @@
##           master    #2655      +/-   ##
==========================================
+ Coverage   30.45%   32.24%   +1.78%     
==========================================
  Files         505      543      +38     
  Lines       34387    26451    -7936     
  Branches        0      260     +260     
==========================================
- Hits        10473     8529    -1944     
+ Misses      23914    17882    -6032     
- Partials        0       40      +40     
Impacted Files Coverage Δ
components/breadcrumb/Breadcrumb.razor 100.00% <100.00%> (+100.00%) ⬆️
components/breadcrumb/Breadcrumb.razor.cs 90.00% <100.00%> (+90.00%) ⬆️
components/breadcrumb/BreadcrumbItem.razor 97.67% <100.00%> (+97.67%) ⬆️
components/core/Helpers/MemberPath/PathNode.cs 46.15% <0.00%> (-8.85%) ⬇️
components/avatar/AvatarGroup.razor 75.00% <0.00%> (-8.34%) ⬇️
components/core/Reflection/TypeDefined.cs 77.77% <0.00%> (-7.94%) ⬇️
components/input/InputGroup.razor.cs 87.50% <0.00%> (-6.95%) ⬇️
components/core/Helpers/DateHelper.cs 85.33% <0.00%> (-4.90%) ⬇️
...ponents/date-picker/types/DatePickerPlaceholder.cs 22.72% <0.00%> (-4.20%) ⬇️
...onents/date-picker/internal/DatePickerHeader.razor 41.86% <0.00%> (-3.21%) ⬇️
... and 445 more

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

[CascadingParameter]
public Breadcrumb BreadCrumb { get; set; }
[Parameter]
public EventCallback<MouseEventArgs> OnClick { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

I think it's better to pass in the current BreadcrumbOption.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we pass back the BreadcrumbItem itself? From what I could tell, the BreadcrumbOption class is not used anywhere yet. I just didn't remove it because it was public.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, that fine, but it's better to pass some info of current item to user

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, makes sense. I went ahead and did a Tuple<MouseEventArgs, BreadcrumbItem> so the user has access to the click arguments and the item since both have useful information. How does that look?

Copy link
Member

Choose a reason for hiding this comment

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

That's fine. Do you plan to fix HTML differences(#2658) here?

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 was thinking of doing that in a separate PR after these changes get in. Would that just be PR'd to master or somewhere else since it will completely change the HTML for existing users? Wasn't sure if that would be considered a breaking change or not.

Copy link
Member

Choose a reason for hiding this comment

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

I think this is a breaking change for CSS, not for HTML or Blazor. CSS has been updated in the latest version, but HTML hasn't caught up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was a pretty small change to update the HTML markup so I went ahead and did that too. It is now in this PR.

@ElderJames ElderJames mentioned this pull request Sep 1, 2022
62 tasks
Key Roche added 3 commits September 2, 2022 12:03
…ventArgs, BreadcrumbItem> giving access to the click arguments and the item clicked.
…, ol and li elements instead of div and spans only)

private async void _onClick(MouseEventArgs args)
Copy link
Member

Choose a reason for hiding this comment

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

It's better to name HandleOnClick

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. I see you changed the signature of the OnClick to just be MouseEventArgs now though. This method isn't needed anymore then since you can directly pass OnClick to the element.

Copy link
Member

@ElderJames ElderJames left a comment

Choose a reason for hiding this comment

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

LGTM

@ElderJames ElderJames merged commit 27b3e8a into ant-design-blazor:master Sep 3, 2022
@kooliokey kooliokey deleted the test/breadcrumbs branch September 3, 2022 21:38
ElderJames added a commit that referenced this pull request Sep 6, 2022
…d Tests, Remove unusable code (#2655)

* Add OnClick parameter to BreadcrumbItem. Add tests for Breadcrumb and BreadcrumbItem. Remove unused and unreachable code until needed at a later date. Documented parameters not in use, but left to avoid breaking the existing public API.

* Fix whitespace

* Update signature of OnClick for BreadcrumbItem to pass a Tuple<MouseEventArgs, BreadcrumbItem> giving access to the click arguments and the item clicked.

* Add ExludeFromCodeCoverage to POCO

* Update HTML markup for Breadcrumbs to match React Ant.Design (use nav, ol and li elements instead of div and spans only)

* fix naming

* fix error

* fix test

Co-authored-by: James Yeung <shunjiey@hotmail.com>
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

2 participants