@@ -38,6 +38,7 @@ describe('MdInputContainer', function () {
3838 MdInputContainerTextTestController ,
3939 MdInputContainerPasswordTestController ,
4040 MdInputContainerNumberTestController ,
41+ MdInputContainerZeroTestController ,
4142 MdTextareaWithBindings ,
4243 MdInputContainerWithDisabled ,
4344 MdInputContainerMissingMdInputTestController
@@ -127,6 +128,19 @@ describe('MdInputContainer', function () {
127128 expect ( el . classList . contains ( 'md-empty' ) ) . toBe ( false , 'should not be empty' ) ;
128129 } ) ) ;
129130
131+ it ( 'should not treat the number 0 as empty' , async ( ( ) => {
132+ let fixture = TestBed . createComponent ( MdInputContainerZeroTestController ) ;
133+ fixture . detectChanges ( ) ;
134+
135+ fixture . whenStable ( ) . then ( ( ) => {
136+ fixture . detectChanges ( ) ;
137+
138+ let el = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
139+ expect ( el ) . not . toBeNull ( ) ;
140+ expect ( el . classList . contains ( 'md-empty' ) ) . toBe ( false ) ;
141+ } ) ;
142+ } ) ) ;
143+
130144 it ( 'should add id' , ( ) => {
131145 let fixture = TestBed . createComponent ( MdInputContainerTextTestController ) ;
132146 fixture . detectChanges ( ) ;
@@ -405,6 +419,16 @@ class MdInputContainerPasswordTestController {}
405419} )
406420class MdInputContainerNumberTestController { }
407421
422+ @Component ( {
423+ template : `
424+ <md-input-container>
425+ <input md-input type="number" placeholder="Placeholder" [(ngModel)]="value">
426+ </md-input-container>`
427+ } )
428+ class MdInputContainerZeroTestController {
429+ value = 0 ;
430+ }
431+
408432@Component ( {
409433 template : `
410434 <md-input-container>
0 commit comments