@@ -18,8 +18,6 @@ import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms';
18
18
import { Subscription } from 'rxjs/Subscription' ;
19
19
import { ENTER , DOWN_ARROW , SPACE , UP_ARROW , HOME , END } from '../core/keyboard/keycodes' ;
20
20
import { MdOption } from '../core/option/option' ;
21
- import { ViewportRuler } from '../core/overlay/position/viewport-ruler' ;
22
- import { FakeViewportRuler } from '../core/overlay/position/fake-viewport-ruler' ;
23
21
import { MdAutocomplete } from './autocomplete' ;
24
22
import { MdInputContainer } from '../input/input-container' ;
25
23
import { Observable } from 'rxjs/Observable' ;
@@ -65,10 +63,7 @@ describe('MdAutocomplete', () => {
65
63
66
64
return { getContainerElement : ( ) => overlayContainerElement } ;
67
65
} } ,
68
- { provide : Dir , useFactory : ( ) => {
69
- return { value : dir } ;
70
- } } ,
71
- { provide : ViewportRuler , useClass : FakeViewportRuler } ,
66
+ { provide : Dir , useFactory : ( ) => ( { value : dir } ) } ,
72
67
{ provide : ScrollDispatcher , useFactory : ( ) => {
73
68
return { scrolled : ( delay : number , callback : ( ) => any ) => {
74
69
return scrolledSubject . asObservable ( ) . subscribe ( callback ) ;
@@ -929,8 +924,8 @@ describe('MdAutocomplete', () => {
929
924
const panelTop = panel . getBoundingClientRect ( ) . top ;
930
925
931
926
// Panel is offset by 6px in styles so that the underline has room to display.
932
- expect ( ( inputBottom + 6 ) . toFixed ( 1 ) )
933
- . toEqual ( panelTop . toFixed ( 1 ) , `Expected panel top to match input bottom by default.` ) ;
927
+ expect ( Math . floor ( inputBottom + 6 ) )
928
+ . toEqual ( Math . floor ( panelTop ) , `Expected panel top to match input bottom by default.` ) ;
934
929
expect ( fixture . componentInstance . trigger . autocomplete . positionY )
935
930
. toEqual ( 'below' , `Expected autocomplete positionY to default to below.` ) ;
936
931
} ) ;
@@ -952,7 +947,7 @@ describe('MdAutocomplete', () => {
952
947
const panel = overlayContainerElement . querySelector ( '.mat-autocomplete-panel' ) ;
953
948
const panelTop = panel . getBoundingClientRect ( ) . top ;
954
949
955
- expect ( ( inputBottom + 6 ) . toFixed ( 1 ) ) . toEqual ( panelTop . toFixed ( 1 ) ,
950
+ expect ( Math . floor ( inputBottom + 6 ) ) . toEqual ( Math . floor ( panelTop ) ,
956
951
'Expected panel top to match input bottom after scrolling.' ) ;
957
952
958
953
document . body . removeChild ( spacer ) ;
@@ -971,8 +966,8 @@ describe('MdAutocomplete', () => {
971
966
const panelBottom = panel . getBoundingClientRect ( ) . bottom ;
972
967
973
968
// Panel is offset by 24px in styles so that the label has room to display.
974
- expect ( ( inputTop - 24 ) . toFixed ( 1 ) )
975
- . toEqual ( panelBottom . toFixed ( 1 ) , `Expected panel to fall back to above position.` ) ;
969
+ expect ( Math . floor ( inputTop - 24 ) )
970
+ . toEqual ( Math . floor ( panelBottom ) , `Expected panel to fall back to above position.` ) ;
976
971
expect ( fixture . componentInstance . trigger . autocomplete . positionY )
977
972
. toEqual ( 'above' , `Expected autocomplete positionY to be "above" if panel won't fit.` ) ;
978
973
} ) ;
@@ -994,8 +989,8 @@ describe('MdAutocomplete', () => {
994
989
const panelBottom = panel . getBoundingClientRect ( ) . bottom ;
995
990
996
991
// Panel is offset by 24px in styles so that the label has room to display.
997
- expect ( ( inputTop - 24 ) . toFixed ( 1 ) )
998
- . toEqual ( panelBottom . toFixed ( 1 ) , `Expected panel to stay aligned after filtering.` ) ;
992
+ expect ( Math . floor ( inputTop - 24 ) )
993
+ . toEqual ( Math . floor ( panelBottom ) , `Expected panel to stay aligned after filtering.` ) ;
999
994
expect ( fixture . componentInstance . trigger . autocomplete . positionY )
1000
995
. toEqual ( 'above' , `Expected autocomplete positionY to be "above" if panel won't fit.` ) ;
1001
996
} ) ;
0 commit comments