From c59777140866c6c373917c95c682d3a6a354ec78 Mon Sep 17 00:00:00 2001 From: crisbeto Date: Tue, 13 Dec 2016 21:49:56 +0100 Subject: [PATCH] Add a unit test to verify that the class is added to the panel. --- src/lib/select/select.spec.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lib/select/select.spec.ts b/src/lib/select/select.spec.ts index d93404c6733e..e19b0e195ee5 100644 --- a/src/lib/select/select.spec.ts +++ b/src/lib/select/select.spec.ts @@ -1,4 +1,4 @@ -import {TestBed, async, ComponentFixture} from '@angular/core/testing'; +import {TestBed, async, ComponentFixture, fakeAsync, tick} from '@angular/core/testing'; import {By} from '@angular/platform-browser'; import {Component, DebugElement, QueryList, ViewChild, ViewChildren} from '@angular/core'; import {MdSelectModule} from './index'; @@ -497,6 +497,20 @@ describe('MdSelect', () => { expect(fixture.componentInstance.select._placeholderState).toEqual('floating-rtl'); }); + + it('should add a class to the panel when the menu is done animating', fakeAsync(() => { + trigger.click(); + fixture.detectChanges(); + + const panel = overlayContainerElement.querySelector('.md-select-panel'); + + expect(panel.classList).not.toContain('md-select-panel-done-animating'); + + tick(250); + fixture.detectChanges(); + + expect(panel.classList).toContain('md-select-panel-done-animating'); + })); }); describe('positioning', () => {