@@ -26,7 +26,8 @@ describe('MdSelect', () => {
2626 SelectInitWithoutOptions ,
2727 SelectWithChangeEvent ,
2828 CustomSelectAccessor ,
29- CompWithCustomSelect
29+ CompWithCustomSelect ,
30+ FloatingPlaceholderSelect
3031 ] ,
3132 providers : [
3233 { provide : OverlayContainer , useFactory : ( ) => {
@@ -1221,6 +1222,20 @@ describe('MdSelect', () => {
12211222 } ) ;
12221223 } ) ) ;
12231224
1225+ it ( 'should be able to disable the floating placeholder' , ( ) => {
1226+ let fixture = TestBed . createComponent ( FloatingPlaceholderSelect ) ;
1227+ let placeholder = fixture . debugElement . query ( By . css ( '.md-select-placeholder' ) ) . nativeElement ;
1228+
1229+ fixture . detectChanges ( ) ;
1230+
1231+ expect ( placeholder . style . visibility ) . toBe ( 'visible' ) ;
1232+
1233+ fixture . componentInstance . control . setValue ( 'pizza-1' ) ;
1234+ fixture . detectChanges ( ) ;
1235+
1236+ expect ( placeholder . style . visibility ) . toBe ( 'hidden' ) ;
1237+ } ) ;
1238+
12241239 } ) ;
12251240
12261241 describe ( 'change event' , ( ) => {
@@ -1433,6 +1448,29 @@ class CompWithCustomSelect {
14331448 @ViewChild ( CustomSelectAccessor ) customAccessor : CustomSelectAccessor ;
14341449}
14351450
1451+ @Component ( {
1452+ selector : 'floating-placeholder-select' ,
1453+ template : `
1454+ <md-select placeholder="Food I want to eat right now" [formControl]="control"
1455+ [floatingPlaceholder]="floatingPlaceholder">
1456+ <md-option *ngFor="let food of foods" [value]="food.value">
1457+ {{ food.viewValue }}
1458+ </md-option>
1459+ </md-select>
1460+ ` ,
1461+ } )
1462+ class FloatingPlaceholderSelect {
1463+ floatingPlaceholder : boolean = false ;
1464+ foods : any [ ] = [
1465+ { value : 'steak-0' , viewValue : 'Steak' } ,
1466+ { value : 'pizza-1' , viewValue : 'Pizza' } ,
1467+ { value : 'tacos-2' , viewValue : 'Tacos' }
1468+ ] ;
1469+ control = new FormControl ( ) ;
1470+
1471+ @ViewChild ( MdSelect ) select : MdSelect ;
1472+ }
1473+
14361474
14371475/**
14381476 * TODO: Move this to core testing utility until Angular has event faking
0 commit comments