@@ -16,7 +16,7 @@ import {
16
16
UP_ARROW ,
17
17
BACKSPACE
18
18
} from '../core/keyboard/keycodes' ;
19
- import { dispatchKeyboardEvent , dispatchMouseEvent } from '@angular/cdk/testing' ;
19
+ import { dispatchFakeEvent , dispatchKeyboardEvent , dispatchMouseEvent } from '@angular/cdk/testing' ;
20
20
21
21
describe ( 'MdSlider without forms' , ( ) => {
22
22
let gestureConfig : TestGestureConfig ;
@@ -141,15 +141,13 @@ describe('MdSlider without forms', () => {
141
141
expect ( sliderNativeElement . classList ) . not . toContain ( 'mat-slider-sliding' ) ;
142
142
} ) ;
143
143
144
- it ( 'should remove focus after the slider is updated ' , ( ) => {
145
- spyOn ( sliderNativeElement , 'blur' ) ;
144
+ it ( 'should reset active state upon blur ' , ( ) => {
145
+ sliderInstance . _isActive = true ;
146
146
147
- expect ( sliderNativeElement . blur ) . not . toHaveBeenCalled ( ) ;
148
-
149
- dispatchClickEventSequence ( sliderNativeElement , 0.39 ) ;
147
+ dispatchFakeEvent ( sliderNativeElement , 'blur' ) ;
150
148
fixture . detectChanges ( ) ;
151
149
152
- expect ( sliderNativeElement . blur ) . toHaveBeenCalled ( ) ;
150
+ expect ( sliderInstance . _isActive ) . toBe ( false ) ;
153
151
} ) ;
154
152
155
153
it ( 'should have thumb gap when at min value' , ( ) => {
@@ -969,6 +967,24 @@ describe('MdSlider without forms', () => {
969
967
expect ( sliderInstance . value ) . toBe ( 30 ) ;
970
968
} ) ;
971
969
970
+ it ( 'should re-render slider with updated style upon directionality change' , ( ) => {
971
+ testComponent . dir = 'rtl' ;
972
+ fixture . detectChanges ( ) ;
973
+
974
+ let initialTrackFillStyles = sliderInstance . _trackFillStyles ;
975
+ let initialTicksContainerStyles = sliderInstance . _ticksContainerStyles ;
976
+ let initialTicksStyles = sliderInstance . _ticksStyles ;
977
+ let initialThumbContainerStyles = sliderInstance . _thumbContainerStyles ;
978
+
979
+ testComponent . dir = 'ltr' ;
980
+ fixture . detectChanges ( ) ;
981
+
982
+ expect ( initialTrackFillStyles ) . not . toEqual ( sliderInstance . _trackFillStyles ) ;
983
+ expect ( initialTicksContainerStyles ) . not . toEqual ( sliderInstance . _ticksContainerStyles ) ;
984
+ expect ( initialTicksStyles ) . not . toEqual ( sliderInstance . _ticksStyles ) ;
985
+ expect ( initialThumbContainerStyles ) . not . toEqual ( sliderInstance . _thumbContainerStyles ) ;
986
+ } ) ;
987
+
972
988
it ( 'should increment inverted slider by 1 on right arrow pressed' , ( ) => {
973
989
testComponent . invert = true ;
974
990
fixture . detectChanges ( ) ;
0 commit comments