@@ -1040,34 +1040,38 @@ describe('MdSelect', () => {
10401040 select . style . marginRight = '20px' ;
10411041 } ) ;
10421042
1043- it ( 'should adjust for the checkbox in ltr' , ( ) => {
1043+ it ( 'should adjust for the checkbox in ltr' , async ( ( ) => {
10441044 trigger . click ( ) ;
10451045 multiFixture . detectChanges ( ) ;
10461046
1047- const triggerLeft = trigger . getBoundingClientRect ( ) . left ;
1048- const firstOptionLeft =
1049- document . querySelector ( '.cdk-overlay-pane md-option' ) . getBoundingClientRect ( ) . left ;
1047+ multiFixture . whenStable ( ) . then ( ( ) => {
1048+ const triggerLeft = trigger . getBoundingClientRect ( ) . left ;
1049+ const firstOptionLeft =
1050+ document . querySelector ( '.cdk-overlay-pane md-option' ) . getBoundingClientRect ( ) . left ;
10501051
1051- // 48px accounts for the checkbox size, margin and the panel's padding.
1052- expect ( firstOptionLeft . toFixed ( 2 ) )
1053- . toEqual ( ( triggerLeft - 48 ) . toFixed ( 2 ) ,
1054- `Expected trigger label to align along x-axis, accounting for the checkbox.` ) ;
1055- } ) ;
1052+ // 48px accounts for the checkbox size, margin and the panel's padding.
1053+ expect ( firstOptionLeft . toFixed ( 2 ) )
1054+ . toEqual ( ( triggerLeft - 48 ) . toFixed ( 2 ) ,
1055+ `Expected trigger label to align along x-axis, accounting for the checkbox.` ) ;
1056+ } ) ;
1057+ } ) ) ;
10561058
1057- it ( 'should adjust for the checkbox in rtl' , ( ) => {
1059+ it ( 'should adjust for the checkbox in rtl' , async ( ( ) => {
10581060 dir . value = 'rtl' ;
10591061 trigger . click ( ) ;
10601062 multiFixture . detectChanges ( ) ;
10611063
1062- const triggerRight = trigger . getBoundingClientRect ( ) . right ;
1063- const firstOptionRight =
1064- document . querySelector ( '.cdk-overlay-pane md-option' ) . getBoundingClientRect ( ) . right ;
1064+ multiFixture . whenStable ( ) . then ( ( ) => {
1065+ const triggerRight = trigger . getBoundingClientRect ( ) . right ;
1066+ const firstOptionRight =
1067+ document . querySelector ( '.cdk-overlay-pane md-option' ) . getBoundingClientRect ( ) . right ;
10651068
1066- // 48px accounts for the checkbox size, margin and the panel's padding.
1067- expect ( firstOptionRight . toFixed ( 2 ) )
1068- . toEqual ( ( triggerRight + 48 ) . toFixed ( 2 ) ,
1069- `Expected trigger label to align along x-axis, accounting for the checkbox.` ) ;
1070- } ) ;
1069+ // 48px accounts for the checkbox size, margin and the panel's padding.
1070+ expect ( firstOptionRight . toFixed ( 2 ) )
1071+ . toEqual ( ( triggerRight + 48 ) . toFixed ( 2 ) ,
1072+ `Expected trigger label to align along x-axis, accounting for the checkbox.` ) ;
1073+ } ) ;
1074+ } ) ) ;
10711075 } ) ;
10721076
10731077 } ) ;
0 commit comments