Skip to content

Commit

Permalink
Numberinput: fix long-press breaking when disabled (#3860)
Browse files Browse the repository at this point in the history
* Numberinput: fix long-press breaking when disabled

* Numberinput: fix long-press unit test
  • Loading branch information
SylvainMarty committed Jun 26, 2023
1 parent ae07176 commit b6233b9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/numberinput/Numberinput.spec.js
Expand Up @@ -108,7 +108,7 @@ describe('BNumberinput', () => {
jest.runOnlyPendingTimers()

wrapper.find('.control.plus').trigger('mouseup')
expect(wrapper.vm.computedValue).toBe(0)
expect(wrapper.vm.computedValue).toBe(1)

// Decrement
wrapper.find('.control.minus button').trigger('mousedown')
Expand Down
2 changes: 1 addition & 1 deletion src/components/numberinput/Numberinput.vue
Expand Up @@ -296,12 +296,12 @@ export default {
if (inc) this.increment()
else this.decrement()
if (!this.longPress) return
this._$intervalRef = setTimeout(() => {
this.longPressTick(inc)
}, this.exponential ? (250 / (this.exponential * this.timesPressed++)) : 250)
},
onStartLongPress(event, inc) {
if (!this.longPress) return
if (event.button !== 0 && event.type !== 'touchstart') return
clearTimeout(this._$intervalRef)
this.longPressTick(inc)
Expand Down

0 comments on commit b6233b9

Please sign in to comment.