@@ -43,6 +43,7 @@ describe('MdInputContainer', function () {
4343 MdInputContainerWithDisabled ,
4444 MdInputContainerWithValueBinding ,
4545 MdInputContainerWithFormControl ,
46+ MdInputContainerWithStaticPlaceholder ,
4647 MdInputContainerMissingMdInputTestController
4748 ] ,
4849 } ) ;
@@ -130,6 +131,26 @@ describe('MdInputContainer', function () {
130131 expect ( el . classList . contains ( 'md-empty' ) ) . toBe ( false , 'should not be empty' ) ;
131132 } ) ) ;
132133
134+ it ( 'should update the placeholder when input entered' , async ( ( ) => {
135+ let fixture = TestBed . createComponent ( MdInputContainerWithStaticPlaceholder ) ;
136+ fixture . detectChanges ( ) ;
137+
138+ let inputEl = fixture . debugElement . query ( By . css ( 'input' ) ) ;
139+ let labelEl = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
140+
141+ expect ( labelEl . classList ) . toContain ( 'md-empty' ) ;
142+ expect ( labelEl . classList ) . not . toContain ( 'md-float' ) ;
143+
144+ // Update the value of the input.
145+ inputEl . nativeElement . value = 'Text' ;
146+
147+ // Fake behavior of the `(input)` event which should trigger a change detection.
148+ fixture . detectChanges ( ) ;
149+
150+ expect ( labelEl . classList ) . not . toContain ( 'md-empty' ) ;
151+ expect ( labelEl . classList ) . not . toContain ( 'md-float' ) ;
152+ } ) ) ;
153+
133154 it ( 'should not be empty when the value set before view init' , async ( ( ) => {
134155 let fixture = TestBed . createComponent ( MdInputContainerWithValueBinding ) ;
135156 fixture . detectChanges ( ) ;
@@ -476,6 +497,15 @@ class MdInputContainerWithValueBinding {
476497 value : string = 'Initial' ;
477498}
478499
500+ @Component ( {
501+ template : `
502+ <md-input-container [floatingPlaceholder]="false">
503+ <input md-input placeholder="Label">
504+ </md-input-container>
505+ `
506+ } )
507+ class MdInputContainerWithStaticPlaceholder { }
508+
479509@Component ( {
480510 template : `
481511 <md-input-container>
0 commit comments