From 2ff4eb97b31db0024098aa5b98756aaef328ee50 Mon Sep 17 00:00:00 2001 From: Jeremy Elbourn Date: Wed, 26 Oct 2016 15:58:01 -0700 Subject: [PATCH] fix(input): floating placeholder on by default --- 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;