Skip to content

feat: adding count label on multiselect component #865

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

Merged
merged 10 commits into from
May 25, 2021

Conversation

alok-traceable
Copy link
Contributor

Description

Current behaviour of Multiselect component label is and more.
This PR contains changes which will Instead of showing "and " will show "+" tag with a grey background and border radius.

Testing

Unit tests to verify the existence of the tag and its value.

Checklist:

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

@codecov
Copy link

codecov bot commented May 20, 2021

Codecov Report

Merging #865 (c55b87a) into main (7cc5e77) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #865      +/-   ##
==========================================
- Coverage   85.36%   85.36%   -0.01%     
==========================================
  Files         799      799              
  Lines       16435    16433       -2     
  Branches     2064     2064              
==========================================
- Hits        14030    14028       -2     
  Misses       2373     2373              
  Partials       32       32              
Impacted Files Coverage Δ
...ponents/src/multi-select/multi-select.component.ts 98.43% <100.00%> (-0.05%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7cc5e77...c55b87a. Read the comment docs.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

padding: 0 6px;
background-color: $gray-2;
border-radius: 4px;
margin-left: 5px;
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess, we use margin/padding as multiple of 4. You may check that.
Otherwise looks good to me!!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

expect(spectator.query(LabelComponent)?.label).toEqual('first and 5 more');
expect(spectator.query(LabelComponent)?.label).toEqual('first');

expect(spectator.component.selectedItemsCount).toBe(6);
Copy link
Contributor

Choose a reason for hiding this comment

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

We should test this from Dom. Example:

expect(spectator.query('.trigger-more-items')).toHaveText('6')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

@github-actions

This comment has been minimized.

@@ -236,10 +240,13 @@ export class MultiSelectComponent<V> implements AfterContentInit, OnChanges {
);
if (selectedItems === undefined || selectedItems.length === 0) {
this.triggerLabel = this.placeholder;
this.selectedItemsCount = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can move this assignment out of the condition then collapse the conditional

this.selectedItemsCount = selectedItems?.length ?? 0;
this.triggerLabel = this.selectedItemsCount === 0 ? this.placeholder : selectedItems[0].label;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

margin-left: 8px;
max-width: 38px;
font-size: 12px;
font-weight: 600;
Copy link
Contributor

Choose a reason for hiding this comment

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

can we pull this font from our shared font styles? We generally want all fonts to be defined in font.scss so we're not defining them adhoc in every style sheet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@alok-traceable alok-traceable merged commit c452358 into main May 25, 2021
@alok-traceable alok-traceable deleted the multi_select_count_label branch May 25, 2021 17:13
@github-actions
Copy link

Unit Test Results

    4 files  ±0  254 suites  ±0   13m 48s ⏱️ -19s
916 tests ±0  916 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
922 runs  ±0  922 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit c452358. ± Comparison against base commit 7cc5e77.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants