@@ -45,6 +45,7 @@ describe('MdInputContainer', function () {
4545 MdInputContainerWithType ,
4646 MdInputContainerWithValueBinding ,
4747 MdInputContainerWithFormControl ,
48+ MdInputContainerWithStaticPlaceholder ,
4849 MdInputContainerMissingMdInputTestController
4950 ] ,
5051 } ) ;
@@ -132,6 +133,26 @@ describe('MdInputContainer', function () {
132133 expect ( el . classList . contains ( 'md-empty' ) ) . toBe ( false , 'should not be empty' ) ;
133134 } ) ) ;
134135
136+ it ( 'should update the placeholder when input entered' , async ( ( ) => {
137+ let fixture = TestBed . createComponent ( MdInputContainerWithStaticPlaceholder ) ;
138+ fixture . detectChanges ( ) ;
139+
140+ let inputEl = fixture . debugElement . query ( By . css ( 'input' ) ) ;
141+ let labelEl = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
142+
143+ expect ( labelEl . classList ) . toContain ( 'md-empty' ) ;
144+ expect ( labelEl . classList ) . not . toContain ( 'md-float' ) ;
145+
146+ // Update the value of the input.
147+ inputEl . nativeElement . value = 'Text' ;
148+
149+ // Fake behavior of the `(input)` event which should trigger a change detection.
150+ fixture . detectChanges ( ) ;
151+
152+ expect ( labelEl . classList ) . not . toContain ( 'md-empty' ) ;
153+ expect ( labelEl . classList ) . not . toContain ( 'md-float' ) ;
154+ } ) ) ;
155+
135156 it ( 'should not be empty when the value set before view init' , async ( ( ) => {
136157 let fixture = TestBed . createComponent ( MdInputContainerWithValueBinding ) ;
137158 fixture . detectChanges ( ) ;
@@ -529,6 +550,15 @@ class MdInputContainerWithValueBinding {
529550 value : string = 'Initial' ;
530551}
531552
553+ @Component ( {
554+ template : `
555+ <md-input-container [floatingPlaceholder]="false">
556+ <input md-input placeholder="Label">
557+ </md-input-container>
558+ `
559+ } )
560+ class MdInputContainerWithStaticPlaceholder { }
561+
532562@Component ( {
533563 template : `
534564 <md-input-container>
0 commit comments