mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
parent
62c8217185
commit
e583a512d7
@ -75,12 +75,14 @@ test( "value", function() {
|
|||||||
var element = $( "<div></div>" ).slider( {
|
var element = $( "<div></div>" ).slider( {
|
||||||
min: -1, value: 0, max: 1
|
min: -1, value: 0, max: 1
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// min with value option vs value method
|
// min with value option vs value method
|
||||||
element.slider( "option", "value", -2 );
|
element.slider( "option", "value", -2 );
|
||||||
equal( element.slider( "option", "value" ), -2, "value option does not respect min" );
|
equal( element.slider( "option", "value" ), -2, "value option does not respect min" );
|
||||||
equal( element.slider( "value" ), -1, "value method get respects min" );
|
equal( element.slider( "value" ), -1, "value method get respects min" );
|
||||||
equal( element.slider( "value", -2 ), element, "value method is chainable" );
|
equal( element.slider( "value", -2 ), element, "value method is chainable" );
|
||||||
equal( element.slider( "option", "value" ), -1, "value method set respects min" );
|
equal( element.slider( "option", "value" ), -1, "value method set respects min" );
|
||||||
|
|
||||||
// max with value option vs value method
|
// max with value option vs value method
|
||||||
element.slider( "option", "value", 2 );
|
element.slider( "option", "value", 2 );
|
||||||
equal( element.slider( "option", "value" ), 2, "value option does not respect max" );
|
equal( element.slider( "option", "value" ), 2, "value option does not respect max" );
|
||||||
|
@ -361,6 +361,7 @@ return $.widget( "ui.slider", $.ui.mouse, {
|
|||||||
|
|
||||||
_change: function( event, index ) {
|
_change: function( event, index ) {
|
||||||
if ( !this._keySliding && !this._mouseSliding ) {
|
if ( !this._keySliding && !this._mouseSliding ) {
|
||||||
|
|
||||||
//store the last changed value index for reference when handles overlap
|
//store the last changed value index for reference when handles overlap
|
||||||
this._lastChangedValue = index;
|
this._lastChangedValue = index;
|
||||||
this._trigger( "change", event, this._uiHash( index ) );
|
this._trigger( "change", event, this._uiHash( index ) );
|
||||||
@ -503,6 +504,7 @@ return $.widget( "ui.slider", $.ui.mouse, {
|
|||||||
|
|
||||||
return val;
|
return val;
|
||||||
} else if ( this._hasMultipleValues() ) {
|
} else if ( this._hasMultipleValues() ) {
|
||||||
|
|
||||||
// .slice() creates a copy of the array
|
// .slice() creates a copy of the array
|
||||||
// this copy gets trimmed by min and max and then returned
|
// this copy gets trimmed by min and max and then returned
|
||||||
vals = this.options.values.slice();
|
vals = this.options.values.slice();
|
||||||
|
Loading…
Reference in New Issue
Block a user