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

fix(VSlider): set value to min if it's less than min (#6604) #6605

Merged
merged 3 commits into from
Mar 3, 2019

Conversation

hrayr-artunyan
Copy link
Contributor

Description

Forces the slider value to be within the boundaries set by min and max props.

Motivation and Context

fixes #6604

How Has This Been Tested?

Tested visually with the provided playground code.

Markup:

<template>
  <v-app>
    <v-layout justify-center wrap>
      <v-flex xs7>
        <v-slider
          v-model="val"
          min="55"
          max="80" />
      </v-flex>
    </v-layout>
  </v-app>
</template>

<script>
  export default {
    data: () => ({
      val: 50
    }),
  }
</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 and documentation updates, dev for new features and breaking changes).
  • My code follows the code style of this project.
  • I've added relevant changes to the documentation (applies to new features and breaking changes in core library)

@nekosaur
Copy link
Member

Thank you for your contribution. Could you possibly create a test for this as well?

dsseng
dsseng previously approved these changes Feb 26, 2019
Copy link
Contributor

@dsseng dsseng left a comment

Choose a reason for hiding this comment

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

Looks good. Please add unit test for this.

@codecov
Copy link

codecov bot commented Feb 26, 2019

Codecov Report

Merging #6605 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6605   +/-   ##
=======================================
  Coverage   85.69%   85.69%           
=======================================
  Files         298      298           
  Lines        7173     7173           
  Branches     1784     1784           
=======================================
  Hits         6147     6147           
  Misses        935      935           
  Partials       91       91
Impacted Files Coverage Δ
packages/vuetify/src/components/VSlider/VSlider.js 99.33% <100%> (ø) ⬆️

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 592f9f0...6af735f. Read the comment docs.

@codecov
Copy link

codecov bot commented Feb 26, 2019

Codecov Report

Merging #6605 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6605   +/-   ##
=======================================
  Coverage   85.68%   85.68%           
=======================================
  Files         298      298           
  Lines        7175     7175           
  Branches     1785     1785           
=======================================
  Hits         6148     6148           
  Misses        936      936           
  Partials       91       91
Impacted Files Coverage Δ
packages/vuetify/src/components/VSlider/VSlider.js 99.33% <100%> (ø) ⬆️

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 67b73b9...13ecbbd. Read the comment docs.

@dsseng
Copy link
Contributor

dsseng commented Feb 27, 2019

@hrayr-artunyan please add unit tests!

@hrayr-artunyan
Copy link
Contributor Author

@sh7dm I will do so shortly. Thank you.

The roundValue function gets used by inputWidth to determine placement of the thumb and various
other elements. If the initial value is less than min, inputWidth will return a negative number due
to the roundValue not being bounded by min and max. This test will check the boundaries.

test for fix vuetifyjs#6604
@hrayr-artunyan
Copy link
Contributor Author

@nekosaur and @sh7dm I finally got around to adding a unit test.

Please test, thanks!

@johnleider johnleider merged commit 91eb0db into vuetifyjs:master Mar 3, 2019
@lock
Copy link

lock bot commented Apr 14, 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 14, 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] VSlider value can be set to be less than the min value and renders incorrectly
4 participants