From 3de57fb1a4789f9b1541f3ebd08d308c39fc7aaf Mon Sep 17 00:00:00 2001 From: Austin Date: Thu, 12 Oct 2017 14:39:43 -0500 Subject: [PATCH] bug(chips): fixes placeholder in chip inputs #7481 (#7509) * bug(chips): fixes placeholder in chip inputs #7481 * chore(nit): pr feedback * chore(tests): fix invalid test * chore(test): remove 'f' --- src/lib/chips/chip-list.spec.ts | 4 ++-- src/lib/chips/chip-list.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/chips/chip-list.spec.ts b/src/lib/chips/chip-list.spec.ts index 25a0b60f2be..2ac30feb928 100644 --- a/src/lib/chips/chip-list.spec.ts +++ b/src/lib/chips/chip-list.spec.ts @@ -366,9 +366,9 @@ describe('MatChipList', () => { }); - it('should not float placeholder if no chip is selected', () => { + it('should float placeholder if chip is selected', () => { expect(formField.classList.contains('mat-form-field-should-float')) - .toBe(false, 'placeholder should not be floating'); + .toBe(true, 'placeholder should be floating'); }); it('should remove selection if chip has been removed', async(() => { diff --git a/src/lib/chips/chip-list.ts b/src/lib/chips/chip-list.ts index f419823e28f..040f862dabb 100644 --- a/src/lib/chips/chip-list.ts +++ b/src/lib/chips/chip-list.ts @@ -244,7 +244,7 @@ export class MatChipList implements MatFormFieldControl, ControlValueAccess } get shouldPlaceholderFloat(): boolean { - return this.empty; + return !this.empty || this.focused; } /** Whether this chip-list is disabled. */