@@ -1119,9 +1119,11 @@ describe('MatSlider', () => {
11191119 describe ( 'slider with direction' , ( ) => {
11201120 let slider : MatSlider ;
11211121 let input : MatSliderThumb ;
1122+ let sliderEl : HTMLElement ;
1123+ let fixture : ComponentFixture < StandardRangeSlider > ;
11221124
11231125 beforeEach ( waitForAsync ( ( ) => {
1124- const fixture = createComponent ( StandardSlider , [
1126+ fixture = createComponent ( StandardSlider , [
11251127 {
11261128 provide : Directionality ,
11271129 useValue : { value : 'rtl' , change : of ( ) } ,
@@ -1130,13 +1132,31 @@ describe('MatSlider', () => {
11301132 fixture . detectChanges ( ) ;
11311133 const sliderDebugElement = fixture . debugElement . query ( By . directive ( MatSlider ) ) ;
11321134 slider = sliderDebugElement . componentInstance ;
1135+ sliderEl = sliderDebugElement . nativeElement ;
11331136 input = slider . _getInput ( _MatThumb . END ) as MatSliderThumb ;
11341137 } ) ) ;
11351138
11361139 it ( 'works in RTL languages' , fakeAsync ( ( ) => {
11371140 setValueByClick ( slider , input , 25 , true ) ;
11381141 checkInput ( input , { min : 0 , max : 100 , value : 75 , translateX : 75 } ) ;
11391142 } ) ) ;
1143+
1144+ it ( 'should position the tick marks correctly with a misaligned step (rtl)' , ( ) => {
1145+ slider . showTickMarks = true ;
1146+ slider . min = 0 ;
1147+ slider . max = 10 ;
1148+ slider . step = 9 ;
1149+
1150+ fixture . detectChanges ( ) ;
1151+
1152+ const activeClass = '.mdc-slider__tick-mark--active' ;
1153+ const inactiveClass = '.mdc-slider__tick-mark--inactive' ;
1154+ const ticks = sliderEl . querySelectorAll ( `${ activeClass } ,${ inactiveClass } ` ) ;
1155+
1156+ expect ( ticks . length ) . toBe ( 2 ) ;
1157+ expect ( ticks [ 0 ] . getBoundingClientRect ( ) . x ) . toBe ( 312 ) ;
1158+ expect ( ticks [ 1 ] . getBoundingClientRect ( ) . x ) . toBeCloseTo ( 47.4 , 2 ) ;
1159+ } ) ;
11401160 } ) ;
11411161
11421162 describe ( 'range slider with direction' , ( ) => {
@@ -1622,11 +1642,17 @@ describe('MatSlider', () => {
16221642 expect ( tickEls . inactive . length ) . toBe ( 0 ) ;
16231643 } ) ;
16241644
1625- // TODO(wagnermaciel): Add this test once this is fixed.
1626- // it('should position the tick marks correctly with a misaligned step', () => {});
1645+ it ( 'should position the tick marks correctly with a misaligned step' , ( ) => {
1646+ slider . max = 10 ;
1647+ slider . step = 9 ;
1648+ fixture . detectChanges ( ) ;
1649+
1650+ const { ticks} = getTickMarkEls ( ) ;
1651+ expect ( ticks . length ) . toBe ( 2 ) ;
16271652
1628- // TODO(wagnermaciel): Add this test once this is fixed.
1629- // it('should position the tick marks correctly with a misaligned step (rtl)', () => {});
1653+ expect ( ticks [ 0 ] . getBoundingClientRect ( ) . x ) . toBe ( 18 ) ;
1654+ expect ( ticks [ 1 ] . getBoundingClientRect ( ) . x ) . toBeCloseTo ( 282.6 , 2 ) ;
1655+ } ) ;
16301656 } ) ;
16311657
16321658 describe ( 'range slider with tick marks' , ( ) => {
0 commit comments