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

Filter comments to count actual rendered elements #4657

Merged
merged 3 commits into from
Sep 2, 2018
Merged

Filter comments to count actual rendered elements #4657

merged 3 commits into from
Sep 2, 2018

Conversation

ebisbe
Copy link
Contributor

@ebisbe ebisbe commented Jul 18, 2018

Description

Motivation and Context

Fixes #4114

How Has This Been Tested?

unit ( snapshot)

Markup:

<template>
  <v-app id="inspire">
    <v-list two-line>
      <v-list-tile>
        <v-list-tile-content>
          <v-list-tile-title>some title</v-list-tile-title>
        </v-list-tile-content>
        <v-list-tile-action>
          <v-list-tile-action-text>Something</v-list-tile-action-text>
          <v-btn v-if="true">a</v-btn>
          <v-btn v-if="false">b</v-btn>
        </v-list-tile-action>
      </v-list-tile>
    </v-list>

    <v-list two-line>
      <v-list-tile>
        <v-list-tile-content>
          <v-list-tile-title>some title</v-list-tile-title>
        </v-list-tile-content>
        <v-list-tile-action>
          <v-btn v-if="true">a</v-btn>
          <v-btn v-if="false">b</v-btn>
        </v-list-tile-action>
      </v-list-tile>
    </v-list>


    <v-list two-line>
      <v-list-tile>
        <v-list-tile-content>
          <v-list-tile-title>some title</v-list-tile-title>
        </v-list-tile-content>
        <v-list-tile-action>
          <v-btn v-if="true">a</v-btn>
        </v-list-tile-action>
      </v-list-tile>
    </v-list>

    <v-list two-line>
      <v-list-tile>
        <v-list-tile-content>
          <v-list-tile-title>some title</v-list-tile-title>
        </v-list-tile-content>
        <v-list-tile-action>
          <v-list-tile-action-text>Hola</v-list-tile-action-text>
          <v-btn v-if="true">a</v-btn>
          <v-btn v-else>b</v-btn>
        </v-list-tile-action>
      </v-list-tile>
    </v-list>
  </v-app>
</template>

<script>
export default {
  data() {
    return {};
  }
};
</script>

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement/refactoring (non-breaking change that doesn't add any feature but make things better)

Checklist:

  • The PR title is no longer than 64 characters.
  • The PR is submitted to the correct branch (master for bug fixes, dev for new features and breaking changes).
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have created a PR in the documentation with the necessary changes.

@codecov
Copy link

codecov bot commented Jul 18, 2018

Codecov Report

Merging #4657 into master will decrease coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/components/VList/VListTileAction.js 100% <100%> (ø) ⬆️
src/components/transitions/expand-transition.js 55.55% <0%> (-3.27%) ⬇️
src/mixins/validatable.js 95.16% <0%> (-1.51%) ⬇️
.../components/VNavigationDrawer/VNavigationDrawer.js 67.77% <0%> (-0.04%) ⬇️
src/components/VAutocomplete/VAutocomplete.js 98.19% <0%> (-0.04%) ⬇️
src/components/VSelect/VSelect.js 95.18% <0%> (-0.03%) ⬇️
src/components/VFooter/VFooter.js 100% <0%> (ø) ⬆️
src/components/VSelect/VSelectList.js 97.1% <0%> (+0.04%) ⬆️
src/mixins/overlayable.js 47.19% <0%> (+0.06%) ⬆️
src/util/helpers.ts 91.91% <0%> (+0.16%) ⬆️
... and 2 more

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 d95a80a...fbc5a35. Read the comment docs.

@KaelWD
Copy link
Member

KaelWD commented Jul 19, 2018

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.

@ebisbe
Copy link
Contributor Author

ebisbe commented Jul 19, 2018

What vue internals?
Test with the playground also? What do you mean with the second phrase?

@@ -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'
Copy link
Member

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

@johnleider
Copy link
Member

Can you add a playground?

@ebisbe
Copy link
Contributor Author

ebisbe commented Jul 28, 2018

Added Playground and filtered out empty VNodes to make the count

@ebisbe
Copy link
Contributor Author

ebisbe commented Aug 4, 2018

@johnleider Anything more to do?

@lock
Copy link

lock bot commented Apr 15, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please direct any non-bug questions to our Discord

@lock lock bot locked as resolved and limited conversation to collaborators Apr 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report] list__tile__action--stack class applied with conditional rendering
3 participants