diff --git a/src/components/input/input.spec.ts b/src/components/input/input.spec.ts
index f7cd43fd9b5d..c51b3406b6db 100644
--- a/src/components/input/input.spec.ts
+++ b/src/components/input/input.spec.ts
@@ -38,6 +38,62 @@ describe('MdInput', function () {
});
});
+ it('should not be treated as empty if type is date', () => {
+ return builder.createAsync(MdInputDateTestController)
+ .then(fixture => {
+ fakeAsync(() => {
+ fixture.componentInstance.placeholder = 'Placeholder';
+ fixture.detectChanges();
+
+ let el = fixture.debugElement.query(By.css('label')).nativeElement;
+ expect(el).not.toBeNull();
+ expect(el.className.includes('md-empty')).toBe(false);
+ })();
+ });
+ });
+
+ it('should treat text input type as empty at init', () => {
+ return builder.createAsync(MdInputTextTestController)
+ .then(fixture => {
+ fakeAsync(() => {
+ fixture.componentInstance.placeholder = 'Placeholder';
+ fixture.detectChanges();
+
+ let el = fixture.debugElement.query(By.css('label')).nativeElement;
+ expect(el).not.toBeNull();
+ expect(el.className.includes('md-empty')).toBe(true);
+ })();
+ });
+ });
+
+ it('should treat password input type as empty at init', () => {
+ return builder.createAsync(MdInputPasswordTestController)
+ .then(fixture => {
+ fakeAsync(() => {
+ fixture.componentInstance.placeholder = 'Placeholder';
+ fixture.detectChanges();
+
+ let el = fixture.debugElement.query(By.css('label')).nativeElement;
+ expect(el).not.toBeNull();
+ expect(el.className.includes('md-empty')).toBe(true);
+ })();
+ });
+ });
+
+ it('should treat number input type as empty at init', () => {
+ return builder.createAsync(MdInputNumberTestController)
+ .then(fixture => {
+ fakeAsync(() => {
+ fixture.componentInstance.placeholder = 'Placeholder';
+ fixture.detectChanges();
+
+ let el = fixture.debugElement.query(By.css('label')).nativeElement;
+ expect(el).not.toBeNull();
+ expect(el.className.includes('md-empty')).toBe(true);
+ })();
+ });
+ });
+
it('support ngModel', () => {
return builder.createAsync(MdInputBaseTestController)
.then(fixture => {
@@ -838,3 +894,39 @@ class MdInputOptionalAttributeController {}
directives: [MdInput]
})
class MdInputWithNameTestController {}
+
+@Component({
+ selector: 'test-input-controller',
+ template: `
+
+ `,
+ directives: [MdInput]
+})
+class MdInputDateTestController {}
+
+@Component({
+ selector: 'test-input-controller',
+ template: `
+
+ `,
+ directives: [MdInput]
+})
+class MdInputTextTestController {}
+
+@Component({
+ selector: 'test-input-controller',
+ template: `
+
+ `,
+ directives: [MdInput]
+})
+class MdInputPasswordTestController {}
+
+@Component({
+ selector: 'test-input-controller',
+ template: `
+
+ `,
+ directives: [MdInput]
+})
+class MdInputNumberTestController {}
\ No newline at end of file