-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(chips): make deselect and toggleSelect private. Update handleChipInteraction/Removal API #3617
Conversation
…Interaction/removal API
detail: {chipId: 'chipA'}, | ||
bubbles: true, | ||
}; | ||
const evt1 = new CustomEvent(MDCChipFoundation.strings.INTERACTION_EVENT, evtData); |
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 don't think this is going to fly in IE. (@williamernest can probably give you more details quickly.)
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.
Yup, talked to Will - thanks for catching it. Will fix it.
All 573 screenshot tests passed for commit be61243 vs. |
Codecov Report
@@ Coverage Diff @@
## master #3617 +/- ##
==========================================
+ Coverage 98.51% 98.52% +0.01%
==========================================
Files 120 120
Lines 5239 5236 -3
Branches 658 658
==========================================
- Hits 5161 5159 -2
+ Misses 78 77 -1
Continue to review full report at Codecov.
|
2 questions:
|
If you want to initialize a chip as selected, Should we not test private methods? I can add a test that triggers the |
RE We typically directly test public APIs with enough cases to cover all private code. Testing private methods directly veers towards testing implementation details. |
@kfranqueiro ... pushed changes for tests. RE |
I don't necessarily think the use of |
@rlfriedman what do you think about my above suggestion? Does that work for you? |
ChipSet will be initialized with the SELECTION_EVENT listening. The Chips will each be initialized and put into selection state: |
I'm not confident that's the case, because AFAICT nothing else will ever actually invoke the Chip's selected setter when it initializes. Chip Set's I'm also not sure it'd be correct to change that, since emitting events for something that arguably has already happened might seem unnatural. |
I see...I did some more investigation and it looks like the demo only initializes the ChipSet, which also initializes all it's Chips, which is why it is needed. So nevermind. :) |
All 557 screenshot tests passed for commit d4da2d4 vs. |
@kfranqueiro - is this PR good to go? |
Yeah I think so. |
All 557 screenshot tests passed for commit 6ffaea8 vs. |
All 557 screenshot tests passed for commit 612c135 vs. |
All 557 screenshot tests passed for commit f287e48 vs. |
All 557 screenshot tests passed for commit b9438ad vs. |
All 557 screenshot tests passed for commit 06329e4 vs. |
Fixes #3612
Fixes #3613
Fixes #3615
BREAKING CHANGE:
deselect
andtoggleSelect
are private methods.handleChipInteraction
andhandleChipRemoval
now acceptchipId
instead of an event.