@@ -4,9 +4,12 @@ import {FormsModule, ReactiveFormsModule} from '@angular/forms';
44import { By } from '@angular/platform-browser' ;
55import { MdInputModule } from './input' ;
66import { MdInputWrapper } from './input-wrapper' ;
7+ import { MdPlatform } from '../core/platform/platform' ;
78
89
910describe ( 'MdInputWrapper' , function ( ) {
11+ let platform : MdPlatform = new MdPlatform ( ) ;
12+
1013 beforeEach ( async ( ( ) => {
1114 TestBed . configureTestingModule ( {
1215 imports : [ MdInputModule . forRoot ( ) , FormsModule , ReactiveFormsModule ] ,
@@ -45,12 +48,26 @@ describe('MdInputWrapper', function () {
4548 } ) ;
4649
4750 it ( 'should not be treated as empty if type is date' , ( ) => {
48- let fixture = TestBed . createComponent ( MdInputWrapperDateTestController ) ;
49- fixture . detectChanges ( ) ;
51+ if ( ! ( platform . TRIDENT || platform . FIREFOX ) ) {
52+ let fixture = TestBed . createComponent ( MdInputWrapperDateTestController ) ;
53+ fixture . detectChanges ( ) ;
5054
51- let el = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
52- expect ( el ) . not . toBeNull ( ) ;
53- expect ( el . classList . contains ( 'md-empty' ) ) . toBe ( false ) ;
55+ let el = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
56+ expect ( el ) . not . toBeNull ( ) ;
57+ expect ( el . classList . contains ( 'md-empty' ) ) . toBe ( false ) ;
58+ }
59+ } ) ;
60+
61+ // Firefox and IE don't support type="date" and fallback to type="text".
62+ it ( 'should be treated as empty if type is date on Firefox and IE' , ( ) => {
63+ if ( platform . TRIDENT || platform . FIREFOX ) {
64+ let fixture = TestBed . createComponent ( MdInputWrapperDateTestController ) ;
65+ fixture . detectChanges ( ) ;
66+
67+ let el = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
68+ expect ( el ) . not . toBeNull ( ) ;
69+ expect ( el . classList . contains ( 'md-empty' ) ) . toBe ( true ) ;
70+ }
5471 } ) ;
5572
5673 it ( 'should treat text input type as empty at init' , ( ) => {
0 commit comments