Permalink
Browse files

Slider: Pass 0 value if slider reaches it

Fixes #12196
Closes gh-1540
  • Loading branch information...
atomiomi authored and scottgonzalez committed Apr 17, 2015
1 parent 0fc9bd2 commit adcc8eff431847b4897666369310cb83275a8282
Showing with 27 additions and 3 deletions.
  1. +25 −1 tests/unit/slider/events.js
  2. +2 −2 ui/slider.js
@@ -169,7 +169,7 @@ test( "mouse based interaction part two: when handles overlap", function() {
});
test( "event data", function() {
expect( 4 );
expect( 6 );
var slideHandleIndex = 3,
values = [ 8, 9, 7, 4 ],
@@ -203,6 +203,30 @@ test( "event data", function() {
});
handles.eq( slideHandleIndex ).simulate( "drag", { dx: 10 } );
element.slider( "destroy" );
element = $( "#slider1" ).slider({
min: 0,
max: 100,
value: 1,
slide: function ( event, ui ) {
equal( ui.value, 0, "should pass 0 value if slider reaches it" );
}
});
handles = element.find( ".ui-slider-handle" );
handles.eq( 0 ).simulate( "drag", { dx: -10 } );
element.slider( "destroy" );
element = $( "#slider1" ).slider({
min: 0,
max: 100,
values: [ 1, 2 ],
slide: function ( event, ui ) {
equal( ui.value, 0, "should pass 0 value if one of handles reaches it" );
}
});
handles = element.find( ".ui-slider-handle" );
handles.eq( 0 ).simulate( "drag", { dx: -10 } );
});
} );
View
@@ -301,11 +301,11 @@ return $.widget( "ui.slider", $.ui.mouse, {
var uiHash = {
handle: this.handles[ index ],
handleIndex: index,
value: value || this.value()
value: value !== undefined ? value : this.value()
};
if ( this._hasMultipleValues() ) {
uiHash.value = value || this.values( index );
uiHash.value = value !== undefined ? value : this.values( index );
uiHash.values = values || this.values();
}

0 comments on commit adcc8ef

Please sign in to comment.