Skip to content

Commit

Permalink
Fixed updateOptions with falsy value for start (#1127)
Browse files Browse the repository at this point in the history
  • Loading branch information
leongersen committed Mar 18, 2021
1 parent b1eb5a8 commit 5c07a50
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

### 14.6.4 (*2021-03-18*)
- Fixed: Fixed `updateOptions` with falsy value for `start` (#1127);

### 14.6.3 (*2020-11-19*)
- Fixed: Fixed removing namespaced event listeners, internal listeners getting removed (#1109);

Expand Down
2 changes: 1 addition & 1 deletion distribute/nouislider.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! nouislider - 14.6.3 - 11/19/2020 */
/*! nouislider - 14.6.4 - 3/18/2021 */
/* Functional styling;
* These styles are required for noUiSlider to function.
* You don't need to change these rules to apply your design.
Expand Down
6 changes: 3 additions & 3 deletions distribute/nouislider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! nouislider - 14.6.3 - 11/19/2020 */
/*! nouislider - 14.6.4 - 3/18/2021 */
(function(factory) {
if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
Expand All @@ -13,7 +13,7 @@
})(function() {
"use strict";

var VERSION = "14.6.3";
var VERSION = "14.6.4";

//region Helper Methods

Expand Down Expand Up @@ -2599,7 +2599,7 @@

// Invalidate the current positioning so valueSet forces an update.
scope_Locations = [];
valueSet(optionsToUpdate.start || v, fireSetEvent);
valueSet(isSet(optionsToUpdate.start) ? optionsToUpdate.start : v, fireSetEvent);
}

// Initialization steps
Expand Down
2 changes: 1 addition & 1 deletion distribute/nouislider.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions distribute/nouislider.min.js

Large diffs are not rendered by default.

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": "14.6.3",
"version": "14.6.4",
"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 @@ -2598,7 +2598,7 @@

// Invalidate the current positioning so valueSet forces an update.
scope_Locations = [];
valueSet(optionsToUpdate.start || v, fireSetEvent);
valueSet(isSet(optionsToUpdate.start) ? optionsToUpdate.start : v, fireSetEvent);
}

// Initialization steps
Expand Down
1 change: 1 addition & 0 deletions tests/slider.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
<script src="slider_errors.js"></script>
<script src="slider_binding.js"></script>
<script src="slider_update-numbers.js"></script>
<script src="slider_update_options.js"></script>
<script src="slider_three_or_more_handles.js"></script>
<script src="slider_contained_handles.js"></script>
<script src="slider_lookaround.js"></script>
Expand Down
20 changes: 20 additions & 0 deletions tests/slider_update_options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
QUnit.test("Update options", function (assert) {

document.getElementById('qunit-fixture').innerHTML = '<div class="slider"></div>';

var slider = document.getElementById('qunit-fixture').querySelector('.slider');

noUiSlider.create(slider, {
start: 20,
range: {
'min': 0,
'max': 100
}
});

slider.noUiSlider.updateOptions({ start: 3 });
assert.deepEqual(slider.noUiSlider.get(), "3.00");

slider.noUiSlider.updateOptions({ start: 0 });
assert.deepEqual(slider.noUiSlider.get(), "0.00");
});

0 comments on commit 5c07a50

Please sign in to comment.