@@ -976,37 +976,41 @@ describe('MdSelect', () => {
976976        select . style . marginRight  =  '20px' ; 
977977      } ) ; 
978978
979-       it ( 'should align the trigger and the selected option on the x-axis in ltr' ,  ( )  =>  { 
979+       it ( 'should align the trigger and the selected option on the x-axis in ltr' ,  async ( ( )  =>  { 
980980        trigger . click ( ) ; 
981981        fixture . detectChanges ( ) ; 
982982
983-         const  triggerLeft  =  trigger . getBoundingClientRect ( ) . left ; 
984-         const  firstOptionLeft  = 
985-             document . querySelector ( '.cdk-overlay-pane md-option' ) . getBoundingClientRect ( ) . left ; 
986- 
987-         // Each option is 32px wider than the trigger, so it must be adjusted 16px 
988-         // to ensure the text overlaps correctly. 
989-         expect ( firstOptionLeft . toFixed ( 2 ) ) 
990-             . toEqual ( ( triggerLeft  -  16 ) . toFixed ( 2 ) , 
991-                 `Expected trigger to align with the selected option on the x-axis in LTR.` ) ; 
992-       } ) ; 
983+         fixture . whenStable ( ) . then ( ( )  =>  { 
984+           const  triggerLeft  =  trigger . getBoundingClientRect ( ) . left ; 
985+           const  firstOptionLeft  = 
986+               document . querySelector ( '.cdk-overlay-pane md-option' ) . getBoundingClientRect ( ) . left ; 
987+ 
988+           // Each option is 32px wider than the trigger, so it must be adjusted 16px 
989+           // to ensure the text overlaps correctly. 
990+           expect ( firstOptionLeft . toFixed ( 2 ) ) 
991+               . toEqual ( ( triggerLeft  -  16 ) . toFixed ( 2 ) , 
992+                   `Expected trigger to align with the selected option on the x-axis in LTR.` ) ; 
993+         } ) ; 
994+       } ) ) ; 
993995
994-       it ( 'should align the trigger and the selected option on the x-axis in rtl' ,  ( )  =>  { 
996+       it ( 'should align the trigger and the selected option on the x-axis in rtl' ,  async ( ( )  =>  { 
995997        dir . value  =  'rtl' ; 
996998
997999        trigger . click ( ) ; 
9981000        fixture . detectChanges ( ) ; 
9991001
1000-         const  triggerRight  =  trigger . getBoundingClientRect ( ) . right ; 
1001-         const  firstOptionRight  = 
1002-             document . querySelector ( '.cdk-overlay-pane md-option' ) . getBoundingClientRect ( ) . right ; 
1003- 
1004-         // Each option is 32px wider than the trigger, so it must be adjusted 16px 
1005-         // to ensure the text overlaps correctly. 
1006-         expect ( firstOptionRight . toFixed ( 2 ) ) 
1007-             . toEqual ( ( triggerRight  +  16 ) . toFixed ( 2 ) , 
1008-                 `Expected trigger to align with the selected option on the x-axis in RTL.` ) ; 
1009-       } ) ; 
1002+         fixture . whenStable ( ) . then ( ( )  =>  { 
1003+           const  triggerRight  =  trigger . getBoundingClientRect ( ) . right ; 
1004+           const  firstOptionRight  = 
1005+               document . querySelector ( '.cdk-overlay-pane md-option' ) . getBoundingClientRect ( ) . right ; 
1006+ 
1007+           // Each option is 32px wider than the trigger, so it must be adjusted 16px 
1008+           // to ensure the text overlaps correctly. 
1009+           expect ( firstOptionRight . toFixed ( 2 ) ) 
1010+               . toEqual ( ( triggerRight  +  16 ) . toFixed ( 2 ) , 
1011+                   `Expected trigger to align with the selected option on the x-axis in RTL.` ) ; 
1012+         } ) ; 
1013+       } ) ) ; 
10101014    } ) ; 
10111015
10121016  } ) ; 
0 commit comments