@@ -38,6 +38,7 @@ describe('MdInputContainer', function () {
38
38
MdInputContainerTextTestController ,
39
39
MdInputContainerPasswordTestController ,
40
40
MdInputContainerNumberTestController ,
41
+ MdInputContainerZeroTestController ,
41
42
MdTextareaWithBindings ,
42
43
MdInputContainerWithDisabled ,
43
44
MdInputContainerMissingMdInputTestController
@@ -127,6 +128,19 @@ describe('MdInputContainer', function () {
127
128
expect ( el . classList . contains ( 'md-empty' ) ) . toBe ( false , 'should not be empty' ) ;
128
129
} ) ) ;
129
130
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
+
130
144
it ( 'should add id' , ( ) => {
131
145
let fixture = TestBed . createComponent ( MdInputContainerTextTestController ) ;
132
146
fixture . detectChanges ( ) ;
@@ -405,6 +419,16 @@ class MdInputContainerPasswordTestController {}
405
419
} )
406
420
class MdInputContainerNumberTestController { }
407
421
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
+
408
432
@Component ( {
409
433
template : `
410
434
<md-input-container>
0 commit comments