Skip to content

Commit 0f3a8fa

Browse files
committed
#15262: Correct logic to cover failed test.
1 parent 3304b54 commit 0f3a8fa

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

ui/widgets/slider.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -548,18 +548,20 @@ return $.widget( "ui.slider", $.ui.mouse, {
548548
var max = this.options.max,
549549
min = this._valueMin(),
550550
step = this.options.step,
551-
aboveMin = Math.round( ( max - min ) / step ) * step;
551+
aboveMin = Math.floor( ( max - min ) / step ) * step;
552552
max = aboveMin + min;
553-
554-
// Round the max before compare with max from options.
555-
max = max.toFixed( this._precision() );
556-
var optionMax = this.options.max.toFixed( this._precision() );
553+
// Round the max before compare with max from option.
554+
max = parseFloat( max.toFixed( this._precision() ) );
555+
var optionMax = parseFloat( this.options.max.toFixed( this._precision() ) );
557556
if ( max > optionMax ) {
558-
559-
//If max is not divisible by step, rounding off may increase its value
557+
// If max is not divisible by step, rounding off may increase its value
560558
max -= step;
561559
}
562-
this.max = parseFloat( max );
560+
// Make sure that max is covered.
561+
else if ( max <= (optionMax - step) ) {
562+
max += step;
563+
}
564+
this.max = max;
563565
},
564566

565567
_precision: function() {

0 commit comments

Comments
 (0)