@@ -657,18 +657,15 @@ describe('MDC-based MatSlider' , () => {
657
657
} ) ;
658
658
659
659
it ( 'should invoke the passed-in `displayWith` function with the value' , ( ) => {
660
- spyOn ( fixture . componentInstance , 'displayWith' ) . and . callThrough ( ) ;
660
+ spyOn ( sliderInstance , 'displayWith' ) . and . callThrough ( ) ;
661
661
sliderInstance . _setValue ( 1337 , Thumb . END ) ;
662
- fixture . whenStable ( ) . then ( ( ) => {
663
- expect ( fixture . componentInstance . displayWith ) . toHaveBeenCalledWith ( 1337 ) ;
664
- } ) ;
662
+ expect ( sliderInstance . displayWith ) . toHaveBeenCalledWith ( 1337 ) ;
665
663
} ) ;
666
664
667
665
it ( 'should format the thumb label based on the passed-in `displayWith` function' , ( ) => {
668
666
sliderInstance . _setValue ( 200000 , Thumb . END ) ;
669
- fixture . whenStable ( ) . then ( ( ) => {
670
- expect ( valueIndicatorTextElement . textContent ) . toBe ( '200k' ) ;
671
- } ) ;
667
+ fixture . detectChanges ( ) ;
668
+ expect ( valueIndicatorTextElement . textContent ) . toBe ( '$200k' ) ;
672
669
} ) ;
673
670
} ) ;
674
671
@@ -693,33 +690,27 @@ describe('MDC-based MatSlider' , () => {
693
690
} ) ;
694
691
695
692
it ( 'should invoke the passed-in `displayWith` function with the start value' , ( ) => {
696
- spyOn ( fixture . componentInstance , 'displayWith' ) . and . callThrough ( ) ;
693
+ spyOn ( sliderInstance , 'displayWith' ) . and . callThrough ( ) ;
697
694
sliderInstance . _setValue ( 1337 , Thumb . START ) ;
698
- fixture . whenStable ( ) . then ( ( ) => {
699
- expect ( fixture . componentInstance . displayWith ) . toHaveBeenCalledWith ( 1337 ) ;
700
- } ) ;
695
+ expect ( sliderInstance . displayWith ) . toHaveBeenCalledWith ( 1337 ) ;
701
696
} ) ;
702
697
703
698
it ( 'should invoke the passed-in `displayWith` function with the end value' , ( ) => {
704
- spyOn ( fixture . componentInstance , 'displayWith' ) . and . callThrough ( ) ;
699
+ spyOn ( sliderInstance , 'displayWith' ) . and . callThrough ( ) ;
705
700
sliderInstance . _setValue ( 5996 , Thumb . END ) ;
706
- fixture . whenStable ( ) . then ( ( ) => {
707
- expect ( fixture . componentInstance . displayWith ) . toHaveBeenCalledWith ( 5996 ) ;
708
- } ) ;
701
+ expect ( sliderInstance . displayWith ) . toHaveBeenCalledWith ( 5996 ) ;
709
702
} ) ;
710
703
711
704
it ( 'should format the start thumb label based on the passed-in `displayWith` function' , ( ) => {
712
705
sliderInstance . _setValue ( 200000 , Thumb . START ) ;
713
- fixture . whenStable ( ) . then ( ( ) => {
714
- expect ( startValueIndicatorTextElement . textContent ) . toBe ( '200k' ) ;
715
- } ) ;
706
+ fixture . detectChanges ( ) ;
707
+ expect ( startValueIndicatorTextElement . textContent ) . toBe ( '$200k' ) ;
716
708
} ) ;
717
709
718
710
it ( 'should format the end thumb label based on the passed-in `displayWith` function' , ( ) => {
719
711
sliderInstance . _setValue ( 700000 , Thumb . END ) ;
720
- fixture . whenStable ( ) . then ( ( ) => {
721
- expect ( endValueIndicatorTextElement . textContent ) . toBe ( '700k' ) ;
722
- } ) ;
712
+ fixture . detectChanges ( ) ;
713
+ expect ( endValueIndicatorTextElement . textContent ) . toBe ( '$700k' ) ;
723
714
} ) ;
724
715
} ) ;
725
716
0 commit comments