Skip to content

Commit

Permalink
Merge pull request #973 from paulharfenmeister/master
Browse files Browse the repository at this point in the history
add full-range padding
  • Loading branch information
leongersen authored Apr 24, 2019
2 parents f73551d + 950191c commit 579dce6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -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);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/nouislider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
}
Expand Down
21 changes: 21 additions & 0 deletions tests/slider_padding.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<div class="slider"></div>';

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');

});

0 comments on commit 579dce6

Please sign in to comment.