Skip to content

Commit 953c25d

Browse files
committed
fix tests for ff & ie
1 parent 2dc5227 commit 953c25d

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

src/lib/input/input-wrapper.spec.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ import {FormsModule, ReactiveFormsModule} from '@angular/forms';
44
import {By} from '@angular/platform-browser';
55
import {MdInputModule} from './input';
66
import {MdInputWrapper} from './input-wrapper';
7+
import {MdPlatform} from '../core/platform/platform';
78

89

910
describe('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

Comments
 (0)