mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: run tslint against e2e directory (#2945)
* Now runs TSLint also against the e2e/ directory. * Add comments for the different tasks in the lint file. * Refactors the screenshot e2e file to pass TSLint and also to be less nested.
This commit is contained in:
committed by
tinayuangao
parent
328f7ef5de
commit
d9f57001cd
@@ -1,38 +1,38 @@
|
||||
import {browser, by, element, Key, ProtractorBy} from 'protractor';
|
||||
import {browser, by, element} from 'protractor';
|
||||
|
||||
describe('fullscreen', () => {
|
||||
beforeEach(() => browser.get('/fullscreen'));
|
||||
|
||||
let overlayInBody = () =>
|
||||
browser.isElementPresent(by.css('body > .cdk-overlay-container') as ProtractorBy);
|
||||
let overlayInFullscreen = () =>
|
||||
browser.isElementPresent(by.css('#fullscreenpane > .cdk-overlay-container') as ProtractorBy);
|
||||
beforeEach(() => browser.get('/fullscreen'));
|
||||
|
||||
it('should open a dialog inside a fullscreen element and move it to the document body', () => {
|
||||
element(by.id('fullscreen')).click();
|
||||
element(by.id('dialog')).click();
|
||||
|
||||
overlayInFullscreen().then((isPresent: boolean) => {
|
||||
expect(isPresent).toBe(true);
|
||||
element(by.id('exitfullscreenindialog')).click();
|
||||
overlayInBody().then((isPresent: boolean) => {
|
||||
expect(isPresent).toBe(true);
|
||||
});
|
||||
});
|
||||
expectOverlayInFullscreen();
|
||||
|
||||
element(by.id('exitfullscreenindialog')).click();
|
||||
expectOverlayInBody();
|
||||
});
|
||||
|
||||
it('should open a dialog inside the document body and move it to a fullscreen element', () => {
|
||||
element(by.id('dialog')).click();
|
||||
overlayInBody().then((isPresent: boolean) => {
|
||||
expect(isPresent).toBe(true);
|
||||
element(by.id('fullscreenindialog')).click();
|
||||
overlayInFullscreen().then((isPresent: boolean) => {
|
||||
expect(isPresent).toBe(true);
|
||||
element(by.id('exitfullscreenindialog')).click();
|
||||
overlayInBody().then((isPresent: boolean) => {
|
||||
expect(isPresent).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
expectOverlayInBody();
|
||||
|
||||
element(by.id('fullscreenindialog')).click();
|
||||
expectOverlayInFullscreen();
|
||||
|
||||
element(by.id('exitfullscreenindialog')).click();
|
||||
expectOverlayInBody();
|
||||
});
|
||||
|
||||
/** Expects the overlay container to be inside of the body element. */
|
||||
function expectOverlayInBody() {
|
||||
expect(browser.isElementPresent(by.css('body > .cdk-overlay-container'))).toBe(true);
|
||||
}
|
||||
|
||||
/** Expects the overlay container to be in fullscreen mode. */
|
||||
function expectOverlayInFullscreen() {
|
||||
expect(browser.isElementPresent(by.css('#fullscreenpane > .cdk-overlay-container'))).toBe(true);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {browser, Key, protractor} from 'protractor';
|
||||
import {Key, protractor} from 'protractor';
|
||||
import {MenuPage} from './menu-page';
|
||||
import {expectToExist, expectAlignedWith, expectFocusOn, expectLocation} from '../../util/asserts';
|
||||
import {pressKeys} from '../../util/actions';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import * as fs from 'fs';
|
||||
import * as gulp from 'gulp';
|
||||
import * as path from 'path';
|
||||
import {browser} from 'protractor';
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import gulp = require('gulp');
|
||||
import {execNodeTask} from '../task_helpers';
|
||||
|
||||
|
||||
gulp.task('lint', ['tslint', 'stylelint', 'madge']);
|
||||
|
||||
/** Task that runs madge to detect circular dependencies. */
|
||||
gulp.task('madge', ['build:release'], execNodeTask('madge', ['--circular', './dist']));
|
||||
|
||||
/** Task to lint Angular Material's scss stylesheets. */
|
||||
gulp.task('stylelint', execNodeTask(
|
||||
'stylelint', ['src/**/*.scss', '--config', 'stylelint-config.json', '--syntax', 'scss']
|
||||
));
|
||||
gulp.task('tslint', execNodeTask('tslint', ['-c', 'tslint.json', 'src/**/*.ts']));
|
||||
|
||||
/** Task to run TSLint against the e2e/ and src/ directories. */
|
||||
gulp.task('tslint', execNodeTask('tslint', ['-c', 'tslint.json', 'src/**/*.ts', 'e2e/**/*.ts']));
|
||||
|
||||
Reference in New Issue
Block a user