diff --git a/CHANGELOG.MD b/CHANGELOG.MD index c8ee75d7..f7607ca7 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,5 +1,8 @@ # Changelog +### 13.1.5 (*2019-03-20*) +- Fixed: Full-range padding (#880); + ### 13.1.4 (*2019-03-20*) - Fixed: Keyboard interaction does not work with `snap` option (#961); diff --git a/package.json b/package.json index 70861cc2..21dbe152 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nouislider", - "version": "13.1.4", + "version": "13.1.5", "main": "distribute/nouislider.js", "style": "distribute/nouislider.min.css", "license": "MIT", diff --git a/src/nouislider.js b/src/nouislider.js index 716496a8..7b4820fb 100644 --- a/src/nouislider.js +++ b/src/nouislider.js @@ -689,7 +689,7 @@ throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be a positive number(s)."); } - if (parsed.padding[0] + parsed.padding[1] >= 100) { + if (parsed.padding[0] + parsed.padding[1] > 100) { throw new Error("noUiSlider (" + VERSION + "): 'padding' option must not exceed 100% of the range."); } } diff --git a/tests/slider_padding.js b/tests/slider_padding.js index 4c3afaf2..2c6b08cd 100644 --- a/tests/slider_padding.js +++ b/tests/slider_padding.js @@ -64,3 +64,24 @@ QUnit.test("Padding option", function (assert) { assert.deepEqual(slider.noUiSlider.get(), ['0.00', '90.00'], 'One of the padding values is 0'); }); + +QUnit.test("Padding values <= 100%", function (assert) { + + document.getElementById('qunit-fixture').innerHTML = '
'; + + var settings = { + start: [0, 100], + padding: [30, 70], + range: { + 'min': 0, + 'max': 100 + } + }; + + var slider = document.getElementById('qunit-fixture').querySelector('.slider'); + + noUiSlider.create(slider, settings); + + assert.deepEqual(slider.noUiSlider.get(), ['30.00', '30.00'], 'Slider values can only be 30'); + +});