@@ -19,7 +19,7 @@ import {
19
19
} from '@angular/forms' ;
20
20
import { ViewportRuler } from '../core/overlay/position/viewport-ruler' ;
21
21
22
- describe ( 'MdSelect' , ( ) => {
22
+ fdescribe ( 'MdSelect' , ( ) => {
23
23
let overlayContainerElement : HTMLElement ;
24
24
let dir : { value : string } ;
25
25
@@ -990,41 +990,44 @@ describe('MdSelect', () => {
990
990
describe ( 'x-axis positioning' , ( ) => {
991
991
992
992
beforeEach ( ( ) => {
993
- select . style . marginLeft = '20px' ;
994
- select . style . marginRight = '20px' ;
993
+ select . style . marginLeft = select . style . marginRight = '50px' ;
995
994
} ) ;
996
995
997
- it ( 'should align the trigger and the selected option on the x-axis in ltr' , ( ) => {
996
+ it ( 'should align the trigger and the selected option on the x-axis in ltr' , async ( ( ) => {
998
997
trigger . click ( ) ;
999
998
fixture . detectChanges ( ) ;
1000
999
1001
- const triggerLeft = trigger . getBoundingClientRect ( ) . left ;
1002
- const firstOptionLeft =
1003
- document . querySelector ( '.cdk-overlay-pane md-option' ) . getBoundingClientRect ( ) . left ;
1004
-
1005
- // Each option is 32px wider than the trigger, so it must be adjusted 16px
1006
- // to ensure the text overlaps correctly.
1007
- expect ( firstOptionLeft . toFixed ( 2 ) )
1008
- . toEqual ( ( triggerLeft - 16 ) . toFixed ( 2 ) ,
1009
- `Expected trigger to align with the selected option on the x-axis in LTR.` ) ;
1010
- } ) ;
1000
+ fixture . whenStable ( ) . then ( ( ) => {
1001
+ const triggerLeft = trigger . getBoundingClientRect ( ) . left ;
1002
+ const firstOptionLeft =
1003
+ document . querySelector ( '.cdk-overlay-pane md-option' ) . getBoundingClientRect ( ) . left ;
1004
+
1005
+ // Each option is 32px wider than the trigger, so it must be adjusted 16px
1006
+ // to ensure the text overlaps correctly.
1007
+ expect ( firstOptionLeft . toFixed ( 2 ) )
1008
+ . toEqual ( ( triggerLeft - 16 ) . toFixed ( 2 ) ,
1009
+ `Expected trigger to align with the selected option on the x-axis in LTR.` ) ;
1010
+ } ) ;
1011
+ } ) ) ;
1011
1012
1012
- it ( 'should align the trigger and the selected option on the x-axis in rtl' , ( ) => {
1013
+ it ( 'should align the trigger and the selected option on the x-axis in rtl' , async ( ( ) => {
1013
1014
dir . value = 'rtl' ;
1014
1015
1015
1016
trigger . click ( ) ;
1016
1017
fixture . detectChanges ( ) ;
1017
1018
1018
- const triggerRight = trigger . getBoundingClientRect ( ) . right ;
1019
- const firstOptionRight =
1020
- document . querySelector ( '.cdk-overlay-pane md-option' ) . getBoundingClientRect ( ) . right ;
1021
-
1022
- // Each option is 32px wider than the trigger, so it must be adjusted 16px
1023
- // to ensure the text overlaps correctly.
1024
- expect ( firstOptionRight . toFixed ( 2 ) )
1025
- . toEqual ( ( triggerRight + 16 ) . toFixed ( 2 ) ,
1026
- `Expected trigger to align with the selected option on the x-axis in RTL.` ) ;
1027
- } ) ;
1019
+ fixture . whenStable ( ) . then ( ( ) => {
1020
+ const triggerRight = trigger . getBoundingClientRect ( ) . right ;
1021
+ const firstOptionRight =
1022
+ document . querySelector ( '.cdk-overlay-pane md-option' ) . getBoundingClientRect ( ) . right ;
1023
+
1024
+ // Each option is 32px wider than the trigger, so it must be adjusted 16px
1025
+ // to ensure the text overlaps correctly.
1026
+ expect ( firstOptionRight . toFixed ( 2 ) )
1027
+ . toEqual ( ( triggerRight + 16 ) . toFixed ( 2 ) ,
1028
+ `Expected trigger to align with the selected option on the x-axis in RTL.` ) ;
1029
+ } ) ;
1030
+ } ) ) ;
1028
1031
1029
1032
} ) ;
1030
1033
0 commit comments