From ce26caeb4001798d510fb851bccbcaf9e67ad88b Mon Sep 17 00:00:00 2001 From: Jeremy Elbourn Date: Wed, 26 Oct 2016 16:45:45 -0700 Subject: [PATCH] fix(input): floating placeholder on by default (#1619) --- src/lib/input/input.spec.ts | 9 +++++++++ src/lib/input/input.ts | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib/input/input.spec.ts b/src/lib/input/input.spec.ts index 2c3146293d00..6f53fd3797ff 100644 --- a/src/lib/input/input.spec.ts +++ b/src/lib/input/input.spec.ts @@ -70,6 +70,15 @@ describe('MdInput', function () { expect(fixture.debugElement.query(By.css('input'))).toBeTruthy(); }); + it('should default to flating placeholders', () => { + let fixture = TestBed.createComponent(MdInputBaseTestController); + fixture.detectChanges(); + + let mdInput = fixture.debugElement.query(By.directive(MdInput)).componentInstance as MdInput; + expect(mdInput.floatingPlaceholder) + .toBe(true, 'Expected MdInput to default to having floating placeholders turned on'); + }); + it('should not be treated as empty if type is date', () => { if (isInternetExplorer11()) { return; diff --git a/src/lib/input/input.ts b/src/lib/input/input.ts index 4abbf4148b05..ee569594a2f9 100644 --- a/src/lib/input/input.ts +++ b/src/lib/input/input.ts @@ -167,7 +167,7 @@ export class MdInput implements ControlValueAccessor, AfterContentInit, OnChange @Input() type: string = 'text'; @Input() name: string = null; - private _floatingPlaceholder: boolean = false; + private _floatingPlaceholder: boolean = true; private _autofocus: boolean = false; private _disabled: boolean = false; private _readonly: boolean = false;