@@ -431,6 +431,29 @@ describe('MdSlider', () => {
431431 // The closest snap is at the end of the slider.
432432 expect ( trackFillElement . style . transform ) . toContain ( 'scaleX(1)' ) ;
433433 } ) ;
434+
435+ it ( 'should round the value inside the label based on the provided step' , ( ) => {
436+ let testStep = ( step : number , expected : string ) => {
437+ fixture . componentInstance . step = step ;
438+ fixture . detectChanges ( ) ;
439+ dispatchSlideEventSequence ( sliderNativeElement , 0 , 0.333333 , gestureConfig ) ;
440+ expect ( sliderDebugElement . componentInstance . displayValue . toString ( ) ) . toBe ( expected ) ;
441+ } ;
442+
443+ testStep ( 1 , '33' ) ;
444+ testStep ( 0.1 , '33.3' ) ;
445+ testStep ( 0.01 , '33.33' ) ;
446+ testStep ( 0.001 , '33.333' ) ;
447+ } ) ;
448+
449+ it ( 'should not add decimals to the value if it is a whole number' , ( ) => {
450+ fixture . componentInstance . step = 0.1 ;
451+ fixture . detectChanges ( ) ;
452+
453+ dispatchSlideEventSequence ( sliderNativeElement , 0 , 1 , gestureConfig ) ;
454+
455+ expect ( sliderDebugElement . componentInstance . displayValue ) . toBe ( 100 ) ;
456+ } ) ;
434457 } ) ;
435458
436459 describe ( 'slider with auto ticks' , ( ) => {
@@ -1162,10 +1185,12 @@ class SliderWithMinAndMax {
11621185class SliderWithValue { }
11631186
11641187@Component ( {
1165- template : `<md-slider step="25 "></md-slider>` ,
1188+ template : `<md-slider [ step]="step "></md-slider>` ,
11661189 styles : [ styles ] ,
11671190} )
1168- class SliderWithStep { }
1191+ class SliderWithStep {
1192+ step = 25 ;
1193+ }
11691194
11701195@Component ( {
11711196 template : `<md-slider step="5" tickInterval="auto"></md-slider>` ,
0 commit comments