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

time picker bugfix for empty string #5218

Merged
merged 2 commits into from Oct 23, 2018
Merged

time picker bugfix for empty string #5218

merged 2 commits into from Oct 23, 2018

Conversation

GPlay97
Copy link
Contributor

@GPlay97 GPlay97 commented Oct 4, 2018

Description

I have enhanced the check on setInputData to also validate for empty strings instead of only null values.

Motivation and Context

Otherwise, if empty string provided as value, it produces NaN:NaN

How Has This Been Tested?

Changed the line, tested it - it fixed the issues. Now it will be treated as null value (--:--)

Markup:

<template>
  <div>
    <v-checkbox v-model="landscape" label="Landscape"></v-checkbox>
    <v-time-picker v-model="picker" :landscape="landscape"></v-time-picker>
  </div>
</template>
<script>
  export default {
    data () {
      return {
        picker: '',
        landscape: false
      }
    }
  }
</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.

@GPlay97 GPlay97 changed the title Patch 1 time picker bugfix for empty string Oct 4, 2018
@codecov
Copy link

codecov bot commented Oct 4, 2018

Codecov Report

Merging #5218 into master will increase coverage by 0.62%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5218      +/-   ##
==========================================
+ Coverage   89.09%   89.72%   +0.62%     
==========================================
  Files         230      246      +16     
  Lines        5466     5830     +364     
  Branches     1373     1455      +82     
==========================================
+ Hits         4870     5231     +361     
  Misses        476      476              
- Partials      120      123       +3
Impacted Files Coverage Δ
src/components/VTimePicker/VTimePicker.js 95.71% <100%> (ø) ⬆️
src/components/VTabs/mixins/tabs-watchers.js 84.61% <0%> (-15.39%) ⬇️
src/mixins/themeable.ts 91.3% <0%> (-8.7%) ⬇️
src/directives/ripple.ts 34.51% <0%> (-7.54%) ⬇️
src/components/VBtn/VBtn.ts 96.87% <0%> (-3.13%) ⬇️
src/components/VTabs/VTab.js 96.42% <0%> (-0.45%) ⬇️
src/components/VStepper/VStepperStep.js 67.85% <0%> (-0.15%) ⬇️
src/components/VAutocomplete/VAutocomplete.js 98.16% <0%> (-0.07%) ⬇️
src/util/ThemeProvider.ts 100% <0%> (ø) ⬆️
src/mixins/routable.ts 100% <0%> (ø) ⬆️
... and 58 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 14d343c...f85496d. Read the comment docs.

- otherwise it produces NaN:NaN
@jacekkarczmarczyk
Copy link
Member

Please add unit test

diff --git a/test/unit/components/VTimePicker/VTimePicker.spec.js b/test/unit/components/VTimePicker/VTimePicker.spec.js
index 01657e36..72c1c31d 100644
--- a/test/unit/components/VTimePicker/VTimePicker.spec.js
+++ b/test/unit/components/VTimePicker/VTimePicker.spec.js
@@ -183,6 +183,10 @@ test('VTimePicker.js', ({ mount }) => {
     expect(wrapper.vm.inputHour).toBe(null)
     expect(wrapper.vm.inputMinute).toBe(null)

+    wrapper.vm.setInputData('')
+    expect(wrapper.vm.inputHour).toBe(null)
+    expect(wrapper.vm.inputMinute).toBe(null)
+
     wrapper.vm.setInputData('12:34am')
     expect(wrapper.vm.inputHour).toBe(0)
     expect(wrapper.vm.inputMinute).toBe(34)

@jacekkarczmarczyk jacekkarczmarczyk added this to the v1.3.x milestone Oct 19, 2018
@GPlay97
Copy link
Contributor Author

GPlay97 commented Oct 19, 2018

I have added them :)

@johnleider johnleider merged commit 30064e9 into vuetifyjs:master Oct 23, 2018
nekosaur pushed a commit that referenced this pull request Oct 26, 2018
* time picker bugfix for empty string
- otherwise it produces NaN:NaN

* add unit test for bugfix for empty strings
@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.

None yet

3 participants