From 0d6464e1a49b7a2cad63c34a9def138bbfd3753c Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 5 Mar 2020 12:21:20 -0400 Subject: [PATCH 1/2] fix(b-form-spinbutton): respect step value when decrementing (closes #4884) --- src/components/form-spinbutton/form-spinbutton.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/form-spinbutton/form-spinbutton.js b/src/components/form-spinbutton/form-spinbutton.js index fd46b0e0e51..06d1a6b1626 100644 --- a/src/components/form-spinbutton/form-spinbutton.js +++ b/src/components/form-spinbutton/form-spinbutton.js @@ -168,7 +168,11 @@ export const BFormSpinbutton = /*#__PURE__*/ Vue.extend({ return defaultNumber(this.min, DEFAULT_MIN) }, computedMax() { - return defaultNumber(this.max, DEFAULT_MAX) + // We round down to the nearest maimum step value + const max = defaultNumber(this.max, DEFAULT_MAX) + const step = this.computedStep + const min = this.computedMin + return Math.floor((max - min) / step) * step + min }, computedDelay() { return defaultInteger(this.repeatDelay, DEFAULT_REPEAT_DELAY) || DEFAULT_REPEAT_DELAY From 0e813c2896e8e1be5c5b8c07659b1e15e81be435 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Thu, 5 Mar 2020 12:42:18 -0400 Subject: [PATCH 2/2] Update form-spinbutton.js --- src/components/form-spinbutton/form-spinbutton.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/form-spinbutton/form-spinbutton.js b/src/components/form-spinbutton/form-spinbutton.js index 06d1a6b1626..b92c29b4441 100644 --- a/src/components/form-spinbutton/form-spinbutton.js +++ b/src/components/form-spinbutton/form-spinbutton.js @@ -168,7 +168,7 @@ export const BFormSpinbutton = /*#__PURE__*/ Vue.extend({ return defaultNumber(this.min, DEFAULT_MIN) }, computedMax() { - // We round down to the nearest maimum step value + // We round down to the nearest maximum step value const max = defaultNumber(this.max, DEFAULT_MAX) const step = this.computedStep const min = this.computedMin