@@ -4,9 +4,12 @@ import {FormsModule, ReactiveFormsModule} from '@angular/forms';
4
4
import { By } from '@angular/platform-browser' ;
5
5
import { MdInputModule } from './input' ;
6
6
import { MdInputWrapper } from './input-wrapper' ;
7
+ import { MdPlatform } from '../core/platform/platform' ;
7
8
8
9
9
10
describe ( 'MdInputWrapper' , function ( ) {
11
+ let platform : MdPlatform = new MdPlatform ( ) ;
12
+
10
13
beforeEach ( async ( ( ) => {
11
14
TestBed . configureTestingModule ( {
12
15
imports : [ MdInputModule . forRoot ( ) , FormsModule , ReactiveFormsModule ] ,
@@ -45,12 +48,26 @@ describe('MdInputWrapper', function () {
45
48
} ) ;
46
49
47
50
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 ( ) ;
50
54
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
+ }
54
71
} ) ;
55
72
56
73
it ( 'should treat text input type as empty at init' , ( ) => {
0 commit comments