-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Filter comments to count actual rendered elements #4657
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4657 +/- ##
==========================================
- Coverage 90.14% 90.11% -0.03%
==========================================
Files 206 206
Lines 4919 4935 +16
Branches 1249 1257 +8
==========================================
+ Hits 4434 4447 +13
- Misses 388 391 +3
Partials 97 97
Continue to review full report at Codecov.
|
Maybe I shouldn't've marked that "good first issue", it relies on knowledge of some vue internals. Also please test contributions with actual code too, unit tests alone aren't enough. |
What vue internals? |
@@ -6,7 +6,8 @@ export default { | |||
|
|||
render (h, { data, children }) { | |||
data.staticClass = data.staticClass ? `v-list__tile__action ${data.staticClass}` : 'v-list__tile__action' | |||
if ((children || []).length > 1) data.staticClass += ' v-list__tile__action--stack' | |||
const filteredChild = children.filter(VNode => VNode.isComment === false) | |||
if ((filteredChild || []).length > 1) data.staticClass += ' v-list__tile__action--stack' |
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.
filter will always return an array, you can remove the ||
Can you add a playground? |
Added Playground and filtered out empty VNodes to make the count |
@johnleider Anything more to do? |
Description
Motivation and Context
Fixes #4114
How Has This Been Tested?
unit ( snapshot)
Markup:
Types of changes
Checklist:
master
for bug fixes,dev
for new features and breaking changes).