refactor(sidenav): switch to the angular animations API (#4959)

* refactor(sidenav): switch to the angular animations API

Switches the sidenav to use the `@angular/animations` API. This saves us a lot of code that was involved in orchestrating the various animations, in addition to making it easier to follow. It also makes it possible for the consumer to disable the animations by using the `NoopAnimationsModule`.

* chore: remove redundant annotations

* fix: focus restoration issue in IE

* chore: linting error

* chore: put back the toggle animation promises

* fix: avoid initial animation

* fix: sidenav not showing when animation starts

* chore: update e2e tests
This commit is contained in:
Kristiyan Kostadinov
2017-07-31 21:05:47 +03:00
committed by tinayuangao
parent 846899db0e
commit a882546deb
5 changed files with 185 additions and 413 deletions
+9 -8
View File
@@ -1,26 +1,27 @@
import {browser, by, element, ExpectedConditions} from 'protractor';
import {browser, by, element, ElementFinder} from 'protractor';
describe('sidenav', () => {
describe('opening and closing', () => {
beforeEach(() => browser.get('/sidenav'));
let input = element(by.tagName('md-sidenav'));
let sidenav: ElementFinder;
beforeEach(() => {
browser.get('/sidenav');
sidenav = element(by.tagName('md-sidenav'));
});
it('should be closed', () => {
expect(input.isDisplayed()).toBeFalsy();
expect(sidenav.isDisplayed()).toBeFalsy();
});
it('should open', () => {
element(by.buttonText('Open sidenav')).click();
expect(input.isDisplayed()).toBeTruthy();
expect(sidenav.isDisplayed()).toBeTruthy();
});
it('should close again', () => {
element(by.buttonText('Open sidenav')).click();
element(by.buttonText('Open sidenav')).click();
browser.wait(ExpectedConditions.presenceOf(element(by.className('mat-sidenav-closed'))), 999);
expect(input.isDisplayed()).toBeFalsy();
expect(sidenav.isDisplayed()).toBeFalsy();
});
});
});