-
Notifications
You must be signed in to change notification settings - Fork 11
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
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
padding: 0 6px; | ||
background-color: $gray-2; | ||
border-radius: 4px; | ||
margin-left: 5px; |
There was a problem hiding this comment.
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!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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); |
There was a problem hiding this comment.
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')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
This comment has been minimized.
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; |
There was a problem hiding this comment.
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;
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
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: