chore(test): add protractor4 (#2233)

* chore(test): add protractor4

* fix lint, remove boilerplate files, fix less gen

* separate scripts between package.json

* ignore a2docs.css in boilerplate

* remove tslint in _examples
This commit is contained in:
Filipe Silva 2016-10-06 23:25:52 +01:00 committed by Ward Bell
parent 7c98d16279
commit 5042b3021c
97 changed files with 463 additions and 12826 deletions

View File

@ -37,7 +37,7 @@ var TEMP_PATH = './_temp';
var DOCS_PATH = path.join(PUBLIC_PATH, 'docs');
var EXAMPLES_PATH = path.join(DOCS_PATH, '_examples');
var EXAMPLES_PROTRACTOR_PATH = path.join(EXAMPLES_PATH, '_protractor');
var BOILERPLATE_PATH = path.join(EXAMPLES_PATH, '_boilerplate');
var EXAMPLES_TESTING_PATH = path.join(EXAMPLES_PATH, 'testing/ts');
var NOT_API_DOCS_GLOB = path.join(PUBLIC_PATH, './{docs/*/latest/!(api),!(docs)}/**/*.*');
var RESOURCES_PATH = path.join(PUBLIC_PATH, 'resources');
@ -92,22 +92,16 @@ var _excludeMatchers = _excludePatterns.map(function(excludePattern){
});
var _exampleBoilerplateFiles = [
'.editorconfig',
'a2docs.css',
'package.json',
'styles.css',
'systemjs.config.js',
'tsconfig.json',
'tslint.json',
'typings.json'
'tslint.json'
];
var _exampleDartWebBoilerPlateFiles = ['a2docs.css', 'styles.css'];
var _exampleProtractorBoilerplateFiles = [
'tsconfig.json'
];
var _exampleUnitTestingBoilerplateFiles = [
'karma-test-shim.js',
'karma.conf.js'
@ -205,18 +199,13 @@ function runE2e() {
});
*/
// Not 'fast'; do full setup
gutil.log('runE2e: install _protractor stuff');
var spawnInfo = spawnExt('npm', ['install'], { cwd: EXAMPLES_PROTRACTOR_PATH});
gutil.log('runE2e: install _examples stuff');
var spawnInfo = spawnExt('npm', ['install'], { cwd: EXAMPLES_PATH});
promise = spawnInfo.promise
.then(function() {
gutil.log('runE2e: install _examples stuff');
spawnInfo = spawnExt('npm', ['install'], { cwd: EXAMPLES_PATH})
return spawnInfo.promise;
})
.then(function() {
buildStyles(copyExampleBoilerplate, _.noop);
gutil.log('runE2e: update webdriver');
spawnInfo = spawnExt('npm', ['run', 'webdriver:update'], {cwd: EXAMPLES_PROTRACTOR_PATH});
spawnInfo = spawnExt('npm', ['run', 'webdriver:update'], {cwd: EXAMPLES_PATH});
return spawnInfo.promise;
});
};
@ -251,11 +240,10 @@ function findAndRunE2eTests(filter, outputFile) {
fs.writeFileSync(outputFile, header);
// create an array of combos where each
// combo consists of { examplePath: ... , protractorConfigFilename: ... }
// combo consists of { examplePath: ... }
var examplePaths = [];
var e2eSpecPaths = getE2eSpecPaths(EXAMPLES_PATH);
e2eSpecPaths.forEach(function(specPath) {
var destConfig = path.join(specPath, 'protractor.config.js');
// get all of the examples under each dir where a pcFilename is found
localExamplePaths = getExamplePaths(specPath, true);
// Filter by language
@ -326,7 +314,7 @@ function runProtractor(prepPromise, appDir, appRunSpawnInfo, outputFile) {
// start protractor
var spawnInfo = spawnExt('npm', [ 'run', 'protractor', '--', 'protractor.config.js',
`--specs=${specFilename}`, '--params.appDir=' + appDir, '--params.outputFile=' + outputFile], { cwd: EXAMPLES_PROTRACTOR_PATH });
`--specs=${specFilename}`, '--params.appDir=' + appDir, '--params.outputFile=' + outputFile], { cwd: EXAMPLES_PATH });
spawnInfo.proc.stderr.on('data', function (data) {
transpileError = transpileError || /npm ERR! Exit status 100/.test(data.toString());
@ -477,7 +465,7 @@ gulp.task('_copy-example-boilerplate', function (done) {
function buildStyles(cb, done){
gulp.src(path.join(STYLES_SOURCE_PATH, _styleLessName))
.pipe(less())
.pipe(gulp.dest(EXAMPLES_PATH)).on('end', function(){
.pipe(gulp.dest(BOILERPLATE_PATH)).on('end', function(){
cb().then(function() { done(); });
});
}
@ -488,12 +476,12 @@ function buildStyles(cb, done){
function copyExampleBoilerplate() {
gutil.log('Copying example boilerplate files');
var sourceFiles = _exampleBoilerplateFiles.map(function(fn) {
return path.join(EXAMPLES_PATH, fn);
return path.join(BOILERPLATE_PATH, fn);
});
var examplePaths = excludeDartPaths(getExamplePaths(EXAMPLES_PATH));
var dartWebSourceFiles = _exampleDartWebBoilerPlateFiles.map(function(fn){
return path.join(EXAMPLES_PATH, fn);
return path.join(BOILERPLATE_PATH, fn);
});
var dartExampleWebPaths = getDartExampleWebPaths(EXAMPLES_PATH);
@ -503,14 +491,6 @@ function copyExampleBoilerplate() {
.then(function() {
return copyFiles(dartWebSourceFiles, dartExampleWebPaths, destFileMode);
})
// copy certain files from _examples/_protractor dir to each subdir that contains an e2e-spec file.
.then(function() {
var protractorSourceFiles =
_exampleProtractorBoilerplateFiles
.map(function(name) {return path.join(EXAMPLES_PROTRACTOR_PATH, name); });
var e2eSpecPaths = getE2eSpecPaths(EXAMPLES_PATH);
return copyFiles(protractorSourceFiles, e2eSpecPaths, destFileMode);
})
// copy the unit test boilerplate
.then(function() {
var unittestSourceFiles =
@ -518,6 +498,10 @@ function copyExampleBoilerplate() {
.map(function(name) { return path.join(EXAMPLES_TESTING_PATH, name); });
var unittestPaths = getUnitTestingPaths(EXAMPLES_PATH);
return copyFiles(unittestSourceFiles, unittestPaths, destFileMode);
})
.catch(function(err) {
gutil.log(err);
throw err;
});
}
@ -596,11 +580,6 @@ function deleteExampleBoilerPlate() {
return deleteFiles(_exampleBoilerplateFiles, examplePaths)
.then(function() {
return deleteFiles(_exampleDartWebBoilerPlateFiles, dartExampleWebPaths);
})
.then(function() {
var protractorFiles = _exampleProtractorBoilerplateFiles;
var e2eSpecPaths = getE2eSpecPaths(EXAMPLES_PATH);
return deleteFiles(protractorFiles, e2eSpecPaths);
});
}
@ -820,7 +799,7 @@ gulp.task('_harp-compile', function() {
gulp.task('_shred-devguide-examples', ['_shred-clean-devguide', '_copy-example-boilerplate'], function() {
// Split big shredding task into partials 2016-06-14
var examplePaths = globby.sync(EXAMPLES_PATH+'/*/', {ignore: ['/node_modules', 'typings/', '_protractor/']});
var examplePaths = globby.sync(EXAMPLES_PATH+'/*/', {ignore: ['/node_modules', 'typings/']});
var promise = Promise.resolve(true);
examplePaths.forEach(function (examplePath) {
promise = promise.then(() => docShredder.shredSingleExampleDir(_devguideShredOptions, examplePath));
@ -879,7 +858,6 @@ gulp.task('lint', function() {
'!./public/docs/_examples/**/ts-snippets/*.ts',
'!./public/docs/_examples/style-guide/ts/**/*.avoid.ts',
'!./public/docs/_examples/**/node_modules/**/*',
'!./public/docs/_examples/_protractor/**/*',
'!./public/docs/_examples/**/typings/**/*',
'!./public/docs/_examples/**/typings-ng1/**/*',
'!./public/docs/_examples/**/build/**/*',
@ -1152,7 +1130,7 @@ function getTypingsPaths(basePath) {
function getExamplePaths(basePath, includeBase) {
// includeBase defaults to false
return getPaths(basePath, _exampleConfigFilename, includeBase)
return getPaths(basePath, _exampleConfigFilename, includeBase);
}
function getDartExampleWebPaths(basePath) {
@ -1183,6 +1161,8 @@ function getFilenames(basePath, filename, includeBase) {
// ignore (skip) the top level version.
includePatterns.push("!" + path.join(basePath, "/" + filename));
}
// ignore (skip) the files in BOILERPLATE_PATH.
includePatterns.push("!" + path.join(BOILERPLATE_PATH, "/" + filename));
var nmPattern = path.join(basePath, "**/node_modules/**");
var filenames = globby.sync(includePatterns, {ignore: [nmPattern]});
return filenames;

View File

@ -71,6 +71,7 @@
"q": "^1.4.1",
"tree-kill": "^1.0.0",
"tslint": "^3.15.1",
"typescript": "^2.0.3",
"yargs": "^4.7.1"
},
"dependencies": {

View File

@ -9,8 +9,8 @@ tsconfig.json
tslint.json
typings.json
wallaby.js
_boilerplate/a2docs.css
protractor.config.js
_test-output
**/ts/**/*.js
**/ts-snippets/**/*.js
@ -18,3 +18,4 @@ _test-output
!**/*e2e-spec.js
!systemjs.config.1.js
!_boilerplate/*

View File

@ -0,0 +1,29 @@
{
"name": "angular2-examples",
"version": "1.0.0",
"description": "Example package.json, only contains needed scripts for examples. See _examples/package.json for master package.json.",
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
"e2e": "tsc && concurrently \"http-server\" \"protractor protractor.config.js\"",
"http-server": "tsc && http-server",
"http-server:e2e": "http-server",
"http-server:cli": "http-server dist/",
"lite": "lite-server",
"postinstall": "typings install",
"test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
"tsc": "tsc",
"tsc:w": "tsc -w",
"start:webpack": "webpack-dev-server --inline --progress --port 8080",
"test:webpack": "karma start karma.webpack.conf.js",
"build:webpack": "rimraf dist && webpack --config config/webpack.prod.js --bail",
"build:cli": "ng build",
"build:aot": "ngc -p tsconfig-aot.json && rollup -c rollup.js",
"i18n": "ng-xi18n"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {},
"devDependencies": {},
"repository": {}
}

View File

@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es6",
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
@ -8,9 +8,7 @@
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
"files": [
"e2e-spec.ts"
]
"suppressImplicitAnyIndexErrors": true,
"types": []
}
}

View File

@ -1,14 +0,0 @@
/// <reference path="typings/index.d.ts" />
// Defined in protractor.config.js
declare function setProtractorToNg1Mode(): void;
declare function sendKeys(element: protractor.ElementFinder, str: string): webdriver.promise.Promise<void>;
declare function describeIf(cond: boolean, name: string, func: Function): void;
declare function itIf(cond: boolean, name: string, func: Function): void;
declare namespace protractor {
interface IBrowser {
appIsTs: boolean;
appIsJs: boolean;
}
}

View File

@ -1,21 +0,0 @@
{
"name": "angular2-examples-protractor",
"version": "1.0.0",
"description": "Manage _protractor folder installations",
"scripts": {
"postinstall": "typings install",
"typings": "typings",
"protractor": "protractor",
"webdriver:update": "webdriver-manager update"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"protractor": "^3.3.0",
"typings": "^1.0.4",
"ts-node": "^1.3.0",
"typescript": "^2.0.2"
},
"repository": {}
}

View File

@ -1,8 +0,0 @@
{
"globalDependencies": {
"angular-protractor": "registry:dt/angular-protractor#1.5.0+20160425143459",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node#6.0.0+20160621231320",
"selenium-webdriver": "registry:dt/selenium-webdriver#2.44.0+20160317120654"
}
}

View File

@ -1,5 +1,8 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder } from 'protractor';
import { logging, promise } from 'selenium-webdriver';
/**
* The tests here basically just checking that the end styles
* of each animation are in effect.
@ -23,7 +26,7 @@ describe('Animation Tests', () => {
describe('basic states', () => {
let host: protractor.ElementFinder;
let host: ElementFinder;
beforeEach(() => {
host = element(by.css('hero-list-basic'));
@ -52,7 +55,7 @@ describe('Animation Tests', () => {
describe('styles inline in transitions', () => {
let host: protractor.ElementFinder;
let host: ElementFinder;
beforeEach(function() {
host = element(by.css('hero-list-inline-styles'));
@ -73,7 +76,7 @@ describe('Animation Tests', () => {
describe('combined transition syntax', () => {
let host: protractor.ElementFinder;
let host: ElementFinder;
beforeEach(() => {
host = element(by.css('hero-list-combined-transitions'));
@ -102,7 +105,7 @@ describe('Animation Tests', () => {
describe('two-way transition syntax', () => {
let host: protractor.ElementFinder;
let host: ElementFinder;
beforeEach(() => {
host = element(by.css('hero-list-twoway'));
@ -131,7 +134,7 @@ describe('Animation Tests', () => {
describe('enter & leave', () => {
let host: protractor.ElementFinder;
let host: ElementFinder;
beforeEach(() => {
host = element(by.css('hero-list-enter-leave'));
@ -151,7 +154,7 @@ describe('Animation Tests', () => {
describe('enter & leave & states', () => {
let host: protractor.ElementFinder;
let host: ElementFinder;
beforeEach(function() {
host = element(by.css('hero-list-enter-leave-states'));
@ -180,7 +183,7 @@ describe('Animation Tests', () => {
describe('auto style calc', () => {
let host: protractor.ElementFinder;
let host: ElementFinder;
beforeEach(function() {
host = element(by.css('hero-list-auto'));
@ -200,7 +203,7 @@ describe('Animation Tests', () => {
describe('different timings', () => {
let host: protractor.ElementFinder;
let host: ElementFinder;
beforeEach(() => {
host = element(by.css('hero-list-timings'));
@ -221,7 +224,7 @@ describe('Animation Tests', () => {
describe('multiple keyframes', () => {
let host: protractor.ElementFinder;
let host: ElementFinder;
beforeEach(() => {
host = element(by.css('hero-list-multistep'));
@ -242,7 +245,7 @@ describe('Animation Tests', () => {
describe('parallel groups', () => {
let host: protractor.ElementFinder;
let host: ElementFinder;
beforeEach(() => {
host = element(by.css('hero-list-groups'));
@ -263,7 +266,7 @@ describe('Animation Tests', () => {
describe('adding active heroes', () => {
let host: protractor.ElementFinder;
let host: ElementFinder;
beforeEach(() => {
host = element(by.css('hero-list-basic'));
@ -292,13 +295,14 @@ describe('Animation Tests', () => {
describe('callbacks', () => {
it('fires a callback on start and done', () => {
addActiveHero();
browser.manage().logs().get('browser').then((logs) => {
const animationMessages = logs.filter((log) => {
return log.message.indexOf('Animation') !== -1 ? true : false;
});
browser.manage().logs().get(logging.Type.BROWSER)
.then((logs: webdriver.logging.Entry[]) => {
const animationMessages = logs.filter((log) => {
return log.message.indexOf('Animation') !== -1 ? true : false;
});
expect(animationMessages.length).toBeGreaterThan(0);
});
expect(animationMessages.length).toBeGreaterThan(0);
});
});
});
@ -320,8 +324,8 @@ describe('Animation Tests', () => {
browser.driver.sleep(sleep);
}
function getScaleX(el: protractor.ElementFinder) {
return protractor.promise.all([
function getScaleX(el: ElementFinder) {
return Promise.all([
getBoundingClientWidth(el),
getOffsetWidth(el)
]).then(function(promiseResolutions) {
@ -331,18 +335,17 @@ describe('Animation Tests', () => {
});
}
function getBoundingClientWidth(el: protractor.ElementFinder): protractor.promise.Promise<number> {
function getBoundingClientWidth(el: ElementFinder): promise.Promise<number> {
return browser.executeScript(
'return arguments[0].getBoundingClientRect().width',
el.getWebElement()
);
}
function getOffsetWidth(el: protractor.ElementFinder): protractor.promise.Promise<number> {
function getOffsetWidth(el: ElementFinder): promise.Promise<number> {
return browser.executeScript(
'return arguments[0].offsetWidth',
el.getWebElement()
);
}
});

View File

@ -1,5 +1,6 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { protractor, browser, element, by, ElementFinder } from 'protractor';
const nameSuffix = 'X';
@ -20,7 +21,7 @@ describe('Architecture', () => {
});
it(`has h2 '${expectedH2}'`, () => {
let h2 = element.all(by.css('h2')).map((elt) => elt.getText());
let h2 = element.all(by.css('h2')).map((elt: any) => elt.getText());
expect(h2).toEqual(expectedH2);
});
@ -52,7 +53,7 @@ function heroTests() {
it(`shows updated hero name in details`, async () => {
let input = element.all(by.css('input')).first();
await sendKeys(input, nameSuffix);
input.sendKeys(nameSuffix);
let page = getPageElts();
let hero = await heroFromDetail(page.heroDetail);
let newName = targetHero.name + nameSuffix;
@ -69,7 +70,7 @@ function salesTaxTests() {
it('shows sales tax', async function () {
let page = getPageElts();
await sendKeys(page.salesTaxAmountInput, '10');
page.salesTaxAmountInput.sendKeys('10', protractor.Key.ENTER);
// Note: due to Dart bug USD is shown instead of $
let re = /The sales tax is (\$|USD)1.00/;
expect(page.salesTaxDetail.getText()).toMatch(re);
@ -87,10 +88,12 @@ function getPageElts() {
};
}
async function heroFromDetail(detail: protractor.ElementFinder): Promise<Hero> {
async function heroFromDetail(detail: ElementFinder): Promise<Hero> {
// Get hero id from the first <div>
// let _id = await detail.all(by.css('div')).first().getText();
let _id = await detail.all(by.css('div')).first().getText();
// Get name from the h2
// let _name = await detail.element(by.css('h4')).getText();
let _name = await detail.element(by.css('h4')).getText();
return {
id: +_id.substr(_id.indexOf(' ') + 1),

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('Attribute directives', function () {
let _title = 'My First Attribute Directive';

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('Angular 1 to 2 Quick Reference Tests', function () {
beforeAll(function () {
@ -100,15 +102,14 @@ describe('Angular 1 to 2 Quick Reference Tests', function () {
let resultLabel = movieListComp.element(by.css('span > p'));
heroInput.clear().then(function () {
sendKeys(heroInput, heroName || '').then(function () {
expect(resultLabel.getText()).toBe(expectedLabel);
if (heroName) {
expect(favoriteHeroLabel.isDisplayed()).toBe(true);
expect(favoriteHeroLabel.getText()).toContain(heroName);
} else {
expect(favoriteHeroLabel.isDisplayed()).toBe(false);
}
});
heroInput.sendKeys(heroName || '');
expect(resultLabel.getText()).toBe(expectedLabel);
if (heroName) {
expect(favoriteHeroLabel.isDisplayed()).toBe(true);
expect(favoriteHeroLabel.getText()).toContain(heroName);
} else {
expect(favoriteHeroLabel.isDisplayed()).toBe(false);
}
});
}
});

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
/* tslint:disable:quotemark */
describe('AOT Compilation', function () {

View File

@ -8,7 +8,8 @@
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
"suppressImplicitAnyIndexErrors": true,
"types": []
},
"files": [

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('Component Communication Cookbook Tests', function () {
// Note: '?e2e' which app can read to know it is running in protractor

View File

@ -1,11 +1,13 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder } from 'protractor';
describe('Cookbook: component-relative paths', function () {
interface Page {
title: protractor.ElementFinder;
absComp: protractor.ElementFinder;
relComp: protractor.ElementFinder;
title: ElementFinder;
absComp: ElementFinder;
relComp: ElementFinder;
}
function getPageStruct() {

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('Dependency Injection Cookbook', function () {
beforeAll(function () {
@ -71,7 +73,7 @@ describe('Dependency Injection Cookbook', function () {
let yellow = 'rgba(255, 255, 0, 1)';
expect(target.getCssValue('background-color')).not.toEqual(yellow);
browser.actions().mouseMove(target as any as webdriver.WebElement).perform();
browser.actions().mouseMove(target.getWebElement()).perform();
expect(target.getCssValue('background-color')).toEqual(yellow);
});

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
/* tslint:disable:quotemark */
describe('Dynamic Form', function () {

View File

@ -1,8 +1,10 @@
/// <reference path="../_protractor/e2e.d.ts" />
'use strict'; // necessary for node!
import { browser, element, by, protractor, ElementFinder, ElementArrayFinder } from 'protractor';
import { appLang, describeIf } from '../protractor-helpers';
// THESE TESTS ARE INCOMPLETE
describeIf(browser.appIsTs || browser.appIsJs, 'Form Validation Tests', function () {
describeIf(appLang.appIsTs || appLang.appIsJs, 'Form Validation Tests', function () {
beforeAll(function () {
browser.get('');
@ -41,15 +43,15 @@ describeIf(browser.appIsTs || browser.appIsJs, 'Form Validation Tests', function
const testName = 'Test Name';
let page: {
section: protractor.ElementFinder,
form: protractor.ElementFinder,
title: protractor.ElementFinder,
nameInput: protractor.ElementFinder,
alterEgoInput: protractor.ElementFinder,
powerSelect: protractor.ElementFinder,
errorMessages: protractor.ElementArrayFinder,
heroFormButtons: protractor.ElementArrayFinder,
heroSubmitted: protractor.ElementFinder
section: ElementFinder,
form: ElementFinder,
title: ElementFinder,
nameInput: ElementFinder,
alterEgoInput: ElementFinder,
powerSelect: ElementFinder,
errorMessages: ElementArrayFinder,
heroFormButtons: ElementArrayFinder,
heroSubmitted: ElementFinder
};
function getPage(sectionTag: string) {

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('i18n E2E Tests', () => {
beforeEach(function () {

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder } from 'protractor';
// gulp run-e2e-tests --filter=cb-set-document-title
describe('Set Document Title', function () {
@ -16,7 +18,7 @@ describe('Set Document Title', function () {
];
element.all( by.css( 'ul li a' ) ).each(
function iterator( element, i ) {
function iterator( element: ElementFinder, i: number ) {
element.click();
expect( browser.getTitle() ).toEqual( titles[ i ] );

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('TypeScript to Javascript tests', function () {
beforeAll(function () {
@ -54,7 +56,7 @@ describe('TypeScript to Javascript tests', function () {
expect(h1.getAttribute('class')).toBe('active');
h1.click();
browser.actions().doubleClick(h1 as any as webdriver.WebElement).perform();
browser.actions().doubleClick(h1.getWebElement()).perform();
expect(h1.getAttribute('class')).toBe('active');
});

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('cli-quickstart App', () => {
beforeEach(() => {
return browser.get('/');

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('Component Style Tests', function () {
beforeAll(function () {

View File

@ -1,7 +1,8 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
describe('Dependency Injection Tests', function () {
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder } from 'protractor';
describe('Dependency Injection Tests', function () {
let expectedMsg: string;
let expectedMsgRx: RegExp;
@ -147,14 +148,13 @@ describe('Dependency Injection Tests', function () {
let heroes = element.all(by.css('#unauthorized hero-list div'));
expect(heroes.count()).toBeGreaterThan(0);
heroes.filter(function(elem, index){
return elem.getText().then(function(text) {
let filteredHeroes = heroes.filter((elem: ElementFinder, index: number) => {
return elem.getText().then((text: string) => {
return /secret/.test(text);
});
}).then(function(filteredElements) {
// console.log("******Secret heroes count: "+filteredElements.length);
expect(filteredElements.length).toEqual(0);
});
expect(filteredHeroes.count()).toEqual(0);
});
it('unauthorized user should have no authorized heroes listed', function () {
@ -182,14 +182,13 @@ describe('Dependency Injection Tests', function () {
let heroes = element.all(by.css('#authorized hero-list div'));
expect(heroes.count()).toBeGreaterThan(0);
heroes.filter(function(elem, index){
return elem.getText().then(function(text) {
let filteredHeroes = heroes.filter(function(elem: ElementFinder, index: number){
return elem.getText().then(function(text: string) {
return /secret/.test(text);
});
}).then(function(filteredElements) {
// console.log("******Secret heroes count: "+filteredElements.length);
expect(filteredElements.length).toBeGreaterThan(0);
});
expect(filteredHeroes.count()).toBeGreaterThan(0);
});
it('authorized user should have no unauthorized heroes listed', function () {

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('Displaying Data Tests', function () {
let _title = 'Tour of Heroes';
let _defaultHero = 'Windstorm';

View File

@ -1,6 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
describeIf(browser.appIsTs || browser.appIsJs, 'Forms Tests', function () {
import { browser, element, by } from 'protractor';
import { appLang, describeIf } from '../protractor-helpers';
describeIf(appLang.appIsTs || appLang.appIsJs, 'Forms Tests', function () {
beforeEach(function () {
browser.get('');
@ -45,12 +46,10 @@ describeIf(browser.appIsTs || browser.appIsJs, 'Forms Tests', function () {
let test = 'testing 1 2 3';
let newValue: string;
let alterEgoEle = element.all(by.css('input[name=alterEgo]')).get(0);
alterEgoEle.getAttribute('value').then(function(value) {
// alterEgoEle.sendKeys(test);
sendKeys(alterEgoEle, test);
alterEgoEle.getAttribute('value').then(function(value: string) {
alterEgoEle.sendKeys(test);
newValue = value + test;
expect(alterEgoEle.getAttribute('value')).toEqual(newValue);
}).then(function() {
let b = element.all(by.css('button[type=submit]')).get(0);
return b.click();
}).then(function() {

View File

@ -1,5 +1,5 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
import { browser, element, by } from 'protractor';
describe('Hierarchical dependency injection', function () {
beforeEach(function () {
@ -38,8 +38,7 @@ describe('Hierarchical dependency injection', function () {
let editButtonEle = heroEle.element(by.cssContainingText('button', 'edit'));
editButtonEle.click().then(function() {
let inputEle = heroEle.element(by.css('hero-editor input'));
// return inputEle.sendKeys("foo");
return sendKeys(inputEle, 'foo');
return inputEle.sendKeys('foo');
}).then(function() {
let buttonName = shouldSave ? 'save' : 'cancel';
let buttonEle = heroEle.element(by.cssContainingText('button', buttonName));

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('Homepage Hello World', function () {
beforeAll(function () {
@ -15,9 +17,8 @@ describe('Homepage Hello World', function () {
it('should display entered name', function () {
let testName = 'Bobby Joe';
let nameEle = element.all(by.css('input')).get(0);
nameEle.getAttribute('value').then(function(value) {
// nameEle.sendKeys(testName); // should work but doesn't
sendKeys(nameEle, testName); // utility that does work
nameEle.getAttribute('value').then(function(value: string) {
nameEle.sendKeys(testName);
let newValue = value + testName; // old input box value + new name
expect(nameEle.getAttribute('value')).toEqual(newValue);
}).then(function() {

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('Homepage Tabs', function () {
beforeAll(function () {

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('Homepage Todo', function () {
beforeAll(function () {

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('Lifecycle hooks', function () {
beforeAll(function () {
@ -41,18 +43,13 @@ describe('Lifecycle hooks', function () {
expect(titleEle.getText()).toContain('Windstorm can sing');
expect(changeLogEles.count()).toEqual(2, 'should start with 2 messages');
// heroNameInputEle.sendKeys('-foo-').then(function () {
sendKeys(heroNameInputEle, '-foo-').then(function () {
expect(titleEle.getText()).toContain('Windstorm-foo- can sing');
expect(changeLogEles.count()).toEqual(2, 'should still have 2 messages');
// protractor bug with sendKeys means that line below does not work.
// return powerInputEle.sendKeys('-bar-');
return sendKeys(powerInputEle, '-bar-');
}).then(function () {
expect(titleEle.getText()).toContain('Windstorm-foo- can sing-bar-');
// 7 == 2 previously + length of '-bar-'
expect(changeLogEles.count()).toEqual(7, 'should have 7 messages now');
});
heroNameInputEle.sendKeys('-foo-');
expect(titleEle.getText()).toContain('Windstorm-foo- can sing');
expect(changeLogEles.count()).toEqual(2, 'should still have 2 messages');
powerInputEle.sendKeys('-bar-');
expect(titleEle.getText()).toContain('Windstorm-foo- can sing-bar-');
// 7 == 2 previously + length of '-bar-'
expect(changeLogEles.count()).toEqual(7, 'should have 7 messages now');
});
it('should support DoCheck hook', function () {
@ -65,21 +62,19 @@ describe('Lifecycle hooks', function () {
let logCount: number;
expect(titleEle.getText()).toContain('Windstorm can sing');
changeLogEles.count().then(function(count) {
changeLogEles.count().then(function(count: number) {
// 3 messages to start
expect(count).toEqual(3, 'should start with 3 messages');
logCount = count;
// heroNameInputEle.sendKeys('-foo-').then(function () {
return sendKeys(heroNameInputEle, '-foo-');
return heroNameInputEle.sendKeys('-foo-');
}).then(function () {
expect(titleEle.getText()).toContain('Windstorm-foo- can sing');
return changeLogEles.count();
}).then(function (count) {
}).then(function(count: number) {
// one more for each keystroke
expect(count).toEqual(logCount + 5, 'should add 5 more messages');
logCount = count;
// return powerInputEle.sendKeys('-bar-');
return sendKeys(powerInputEle, '-bar-');
return powerInputEle.sendKeys('-bar-');
}).then(function () {
expect(titleEle.getText()).toContain('Windstorm-foo- can sing-bar-');
expect(changeLogEles.count()).toEqual(logCount + 6, 'should add 6 more messages');
@ -97,16 +92,16 @@ describe('Lifecycle hooks', function () {
expect(childViewInputEle.getAttribute('value')).toContain('Magneta');
expect(commentEle.isPresent()).toBe(false, 'comment should not be in DOM');
logEles.count().then(function(count) {
logEles.count().then(function(count: number) {
logCount = count;
return sendKeys(childViewInputEle, '-test-');
return childViewInputEle.sendKeys('-test-');
}).then(function() {
expect(childViewInputEle.getAttribute('value')).toContain('-test-');
expect(commentEle.isPresent()).toBe(true, 'should have comment because >10 chars');
expect(commentEle.getText()).toContain('long name');
return logEles.count();
}).then(function(count) {
expect(logCount + 6).toEqual(count, '6 additional log messages should have been added');
}).then(function(count: number) {
expect(logCount + 7).toEqual(count, '7 additional log messages should have been added');
logCount = count;
return buttonEle.click();
}).then(function() {
@ -126,15 +121,15 @@ describe('Lifecycle hooks', function () {
expect(childViewInputEle.getAttribute('value')).toContain('Magneta');
expect(commentEle.isPresent()).toBe(false, 'comment should not be in DOM');
logEles.count().then(function(count) {
logEles.count().then(function(count: number) {
logCount = count;
return sendKeys(childViewInputEle, '-test-');
return childViewInputEle.sendKeys('-test-');
}).then(function() {
expect(childViewInputEle.getAttribute('value')).toContain('-test-');
expect(commentEle.isPresent()).toBe(true, 'should have comment because >10 chars');
expect(commentEle.getText()).toContain('long name');
return logEles.count();
}).then(function(count) {
}).then(function(count: number) {
expect(logCount + 5).toEqual(count, '5 additional log messages should have been added');
logCount = count;
return buttonEle.click();
@ -151,7 +146,7 @@ describe('Lifecycle hooks', function () {
let logEles = element.all(by.css('spy-parent h4 ~ div'));
expect(heroEles.count()).toBe(2, 'should have two heroes displayed');
expect(logEles.count()).toBe(2, 'should have two log entries');
sendKeys(inputEle, '-test-').then(function() {
inputEle.sendKeys('-test-').then(function() {
return addHeroButtonEle.click();
}).then(function() {
expect(heroEles.count()).toBe(3, 'should have added one hero');

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('NgModule', function () {
// helpers

View File

@ -1,27 +1,12 @@
{
"name": "angular2-examples-master",
"version": "1.0.0",
"description": "Master package.json, the superset of all dependencies for all of the _example package.json files.",
"description": "Master package.json, the superset of all dependencies for all of the _example package.json files. See _boilerplate/package.json for example npm scripts.",
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
"e2e": "tsc && concurrently \"http-server\" \"protractor protractor.config.js\"",
"http-server": "tsc && http-server",
"http-server:e2e": "http-server",
"http-server:cli": "http-server dist/",
"lite": "lite-server",
"postinstall": "typings install",
"test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings",
"protractor": "protractor",
"webdriver:update": "webdriver-manager update",
"start:webpack": "webpack-dev-server --inline --progress --port 8080",
"test:webpack": "karma start karma.webpack.conf.js",
"build:webpack": "rimraf dist && webpack --config config/webpack.prod.js --bail",
"build:cli": "ng build",
"build:aot": "ngc -p tsconfig-aot.json && rollup -c rollup.js",
"i18n": "ng-xi18n"
"webdriver:update": "webdriver-manager update"
},
"keywords": [],
"author": "",
@ -42,6 +27,7 @@
"angular-in-memory-web-api": "~0.1.1",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"protractor": "^4.0.9",
"reflect-metadata": "^0.1.8",
"rollup": "^0.36.0",
"rollup-plugin-node-resolve": "^2.0.0",
@ -51,7 +37,9 @@
"zone.js": "^0.6.25"
},
"devDependencies": {
"angular-cli": "^1.0.0-beta.5",
"@types/angular": "^1.5.15",
"@types/jasmine": "^2.2.34",
"@types/selenium-webdriver": "^2.53.32",
"angular2-template-loader": "^0.4.0",
"awesome-typescript-loader": "^2.2.4",
"canonical-path": "0.0.2",
@ -62,6 +50,7 @@
"html-loader": "^0.4.3",
"html-webpack-plugin": "^2.16.1",
"http-server": "^0.9.0",
"jasmine": "^2.5.2",
"jasmine-core": "^2.5.2",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
@ -76,7 +65,7 @@
"lodash": "^4.16.2",
"null-loader": "^0.1.1",
"phantomjs-prebuilt": "^2.1.7",
"protractor": "^3.3.0",
"protractor": "^4.0.9",
"raw-loader": "^0.5.1",
"rimraf": "^2.5.4",
"rollup-plugin-commonjs": "^4.1.0",

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('Pipes', function () {
beforeAll(function () {
@ -53,12 +55,10 @@ describe('Pipes', function () {
let factorInputEle = eles.get(1);
let outputEle = element(by.css('power-boost-calculator p'));
baseInputEle.clear().then(function() {
return sendKeys(baseInputEle, '7');
}).then(function() {
baseInputEle.sendKeys('7');
return factorInputEle.clear();
}).then(function() {
return sendKeys(factorInputEle, '3');
}).then(function() {
factorInputEle.sendKeys('3');
expect(outputEle.getText()).toContain('343');
});
});
@ -75,15 +75,10 @@ describe('Pipes', function () {
expect(mutateCheckEle.getAttribute('checked')).toEqual('true', 'should default to mutating array');
expect(flyingHeroesEle.count()).toEqual(2, 'only two of the original heroes can fly');
return sendKeys(nameEle, 'test1\n')
.then(function(){
expect(flyingHeroesEle.count()).toEqual(2, 'no change while mutating array');
return mutateCheckEle.click();
})
.then(function() {
return sendKeys(nameEle, 'test2\n');
})
.then(function() {
nameEle.sendKeys('test1\n');
expect(flyingHeroesEle.count()).toEqual(2, 'no change while mutating array');
mutateCheckEle.click().then(function() {
nameEle.sendKeys('test2\n');
expect(flyingHeroesEle.count()).toEqual(4, 'not mutating; should see both adds');
expect(flyingHeroesEle.get(2).getText()).toContain('test1');
expect(flyingHeroesEle.get(3).getText()).toContain('test2');
@ -105,10 +100,8 @@ describe('Pipes', function () {
expect(mutateCheckEle.getAttribute('checked')).toEqual('true', 'should default to mutating array');
expect(flyingHeroesEle.count()).toEqual(2, 'only two of the original heroes can fly');
return sendKeys(nameEle, 'test1\n')
.then(function(){
expect(flyingHeroesEle.count()).toEqual(3, 'new flying hero should show in mutating array');
});
nameEle.sendKeys('test1\n');
expect(flyingHeroesEle.count()).toEqual(3, 'new flying hero should show in mutating array');
});
it('should show an async hero message', function () {

View File

@ -0,0 +1,36 @@
export var appLang = {
appIsTs: false,
appIsJs: false,
appIsDart: false,
appIsUnknown: false
};
export function describeIf(cond: boolean, name: string, func: () => void): void {
if (cond) {
describe(name, func);
} else {
xdescribe(name, func);
}
}
export function itIf(cond: boolean, name: string, func: (done: DoneFn) => void): void {
if (cond) {
it(name, func);
} else {
xit(name, func);
}
}
// TODO Jesus - figure out what's needed here for the new upgrade chapters
// Allow changing bootstrap mode to NG1 for upgrade tests
export function setProtractorToNg1Mode(): void {
// browser.rootEl = 'body';
// let disableNgAnimate = function() {
// angular.module('disableNgAnimate', []).run(['$animate', function($animate: any) {
// $animate.enabled(false);
// }]);
// };
// browser.addMockModule('disableNgAnimate', disableNgAnimate);
}

View File

@ -43,39 +43,23 @@ exports.config = {
// debugging
// console.log('browser.params:' + JSON.stringify(browser.params));
var protractorHelpers = require('./protractor-helpers.ts');
var appDir = browser.params.appDir;
if (appDir) {
if (appDir.match('/ts') != null) {
browser.appIsTs = true;
protractorHelpers.appLang.appIsTs = true;
} else if (appDir.match('/js') != null) {
browser.appIsJs = true;
protractorHelpers.appLang.appIsJs = true;
} else if (appDir.match('/dart') != null) {
browser.appIsDart = true;
protractorHelpers.appLang.appIsDart = true;
} else {
browser.appIsUnknown = true;
protractorHelpers.appLang.appIsUnknown = true;
}
} else {
browser.appIsUnknown = true;
protractorHelpers.appLang.appIsUnknown = true;
}
jasmine.getEnv().addReporter(new Reporter( browser.params )) ;
global.describeIf = describeIf;
global.itIf = itIf;
global.sendKeys = sendKeys;
// Allow changing bootstrap mode to NG1 for upgrade tests
global.setProtractorToNg1Mode = function() {
browser.useAllAngular2AppRoots = false;
browser.rootEl = 'body';
var disableNgAnimate = function() {
angular.module('disableNgAnimate', []).run(['$animate', function($animate) {
$animate.enabled(false);
}]);
};
browser.addMockModule('disableNgAnimate', disableNgAnimate);
};
jasmine.getEnv().addReporter(new Reporter( browser.params ));
},
jasmineNodeOpts: {
@ -87,40 +71,15 @@ exports.config = {
beforeLaunch: function() {
// add TS support for specs
require('ts-node').register();
require('ts-node').register({
project: './tsconfig.json'
});
}
};
function describeIf(cond, name, func) {
if (cond) {
describe(name, func);
} else {
xdescribe(name, func);
}
}
function itIf(cond, name, func) {
if (cond) {
it(name, func);
} else {
xit(name, func);
}
}
// Hack - because of bug with protractor send keys
// Hack - because of bug with send keys
function sendKeys(element, str) {
return str.split('').reduce(function (promise, char) {
return promise.then(function () {
return element.sendKeys(char);
});
}, element.getAttribute('value'));
// better to create a resolved promise here but ... don't know how with protractor;
}
// See http://jasmine.github.io/2.1/custom_reporter.html
function Reporter(options) {
var _defaultOutputFile = path.resolve(process.cwd(), "../../../../", 'protractor-results.txt');
var _defaultOutputFile = path.resolve(process.cwd(), "../../../", 'protractor-results.txt');
options.outputFile = options.outputFile || _defaultOutputFile;
var _root = { appDir: options.appDir, suites: [] };

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('QuickStart E2E Tests', function () {
let expectedMsg = 'My First Angular App';

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder } from 'protractor';
describe('Router', function () {
beforeAll(function () {
@ -79,12 +81,12 @@ describe('Router', function () {
it('should be able to edit and save details from the heroes view', function () {
let page = getPageStruct();
let heroEle: protractor.ElementFinder;
let heroEle: ElementFinder;
let heroText: string;
page.heroesHref.click().then(function() {
heroEle = page.heroesList.get(4);
return heroEle.getText();
}).then(function(text) {
}).then(function(text: string) {
expect(text.length).toBeGreaterThan(0, 'should have some text');
// remove leading id from text
heroText = text.substr(text.indexOf(' ')).trim();
@ -94,8 +96,7 @@ describe('Router', function () {
expect(page.heroDetail.isPresent()).toBe(true, 'should be able to see crisis detail');
expect(page.heroDetailTitle.getText()).toContain(heroText);
let inputEle = page.heroDetail.element(by.css('input'));
return sendKeys(inputEle, '-foo');
}).then(function() {
inputEle.sendKeys('-foo');
expect(page.heroDetailTitle.getText()).toContain(heroText + '-foo');
let buttonEle = page.heroDetail.element(by.css('button'));
return buttonEle.click();
@ -106,13 +107,13 @@ describe('Router', function () {
function crisisCenterEdit(index: number, shouldSave: boolean) {
let page = getPageStruct();
let crisisEle: protractor.ElementFinder;
let crisisEle: ElementFinder;
let crisisText: string;
page.crisisHref.click()
.then(function () {
crisisEle = page.crisisList.get(index);
return crisisEle.getText();
}).then(function (text) {
}).then(function(text: string) {
expect(text.length).toBeGreaterThan(0, 'should have some text');
// remove leading id from text
crisisText = text.substr(text.indexOf(' ')).trim();
@ -121,8 +122,7 @@ describe('Router', function () {
expect(page.crisisDetail.isPresent()).toBe(true, 'should be able to see crisis detail');
expect(page.crisisDetailTitle.getText()).toContain(crisisText);
let inputEle = page.crisisDetail.element(by.css('input'));
return sendKeys(inputEle, '-foo');
}).then(function () {
inputEle.sendKeys('-foo');
expect(page.crisisDetailTitle.getText()).toContain(crisisText + '-foo');
let buttonEle = page.crisisDetail.element(by.cssContainingText('button', shouldSave ? 'Save' : 'Cancel'));
return buttonEle.click();

View File

@ -1,5 +1,6 @@
/// <reference path="../_protractor/e2e.d.ts" />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, By } from 'protractor';
describe('Security E2E Tests', () => {
beforeAll(() => browser.get(''));

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('Server Communication', function () {
beforeAll(function () {
@ -35,7 +37,7 @@ describe('Server Communication', function () {
it('should add a new hero to the list', function () {
expect(heroNameInput).toBeDefined('<input> for hero name must exist');
expect(addButton).toBeDefined('"Add Hero" button must be defined');
sendKeys(heroNameInput, newHeroName);
heroNameInput.sendKeys(newHeroName);
addButton.click().then(function() {
expect(heroTags.count()).toBe(heroCountAfterAdd, 'A new hero should be added');
let newHeroInList = heroTags.get(heroCountAfterAdd - 1).getText();

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('Structural Directives', function () {
// tests interact - so we need beforeEach instead of beforeAll
@ -34,7 +36,7 @@ describe('Structural Directives', function () {
let cssButtonEle = element(by.cssContainingText('button', 'show | hide'));
let cssSiblingEle = cssButtonEle.element(by.xpath('..')).element(by.css('heavy-loader'));
let setConditionText: string;
setConditionButtonEle.getText().then(function(text) {
setConditionButtonEle.getText().then(function(text: string) {
setConditionText = text;
expect(ngIfButtonEle.isPresent()).toBe(true, 'should be able to find ngIfButton');
expect(cssButtonEle.isPresent()).toBe(true, 'should be able to find cssButton');

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('Style Guide', function () {
it('01-01', function () {
browser.get('#/01-01');

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('Documentation StyleGuide E2E Tests', function() {
let expectedMsg = 'My First Angular App';

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
// Not yet complete
describe('Template Syntax', function () {

View File

@ -1,7 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
type WPromise<T> = webdriver.promise.Promise<T>;
import { browser, element, by, ElementFinder } from 'protractor';
import { promise } from 'selenium-webdriver';
const expectedH1 = 'Tour of Heroes';
const expectedTitle = `Angular ${expectedH1}`;
@ -12,7 +12,7 @@ class Hero {
// Factory method
// Get hero id and name from the given detail element.
static async fromDetail(detail: protractor.ElementFinder): Promise<Hero> {
static async fromDetail(detail: ElementFinder): Promise<Hero> {
// Get hero id from the first <div>
let _id = await detail.all(by.css('div')).first().getText();
// Get name from the h2
@ -25,9 +25,9 @@ class Hero {
}
const nameSuffix = 'X';
function addToHeroName(text: string): WPromise<void> {
function addToHeroName(text: string): promise.Promise<void> {
let input = element(by.css('input'));
return sendKeys(input, text);
return input.sendKeys(text);
}
describe('Tutorial part 1', () => {

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder } from 'protractor';
import { promise } from 'selenium-webdriver';
const expectedH1 = 'Tour of Heroes';
const expectedTitle = `Angular ${expectedH1}`;
@ -7,8 +9,6 @@ const expectedH2 = 'My Heroes';
const targetHero = { id: 16, name: 'RubberMan' };
const nameSuffix = 'X';
type WPromise<T> = webdriver.promise.Promise<T>;
class Hero {
id: number;
name: string;
@ -24,7 +24,7 @@ class Hero {
}
// Get hero id and name from the given detail element.
static async fromDetail(detail: protractor.ElementFinder): Promise<Hero> {
static async fromDetail(detail: ElementFinder): Promise<Hero> {
// Get hero id from the first <div>
let _id = await detail.all(by.css('div')).first().getText();
// Get name from the h2
@ -113,9 +113,9 @@ function updateHeroTests() {
}
function addToHeroName(text: string): WPromise<void> {
function addToHeroName(text: string): promise.Promise<void> {
let input = element(by.css('input'));
return sendKeys(input, text);
return input.sendKeys(text);
}
function expectHeading(hLevel: number, expectedText: string): void {

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder } from 'protractor';
import { promise } from 'selenium-webdriver';
const expectedH1 = 'Tour of Heroes';
const expectedTitle = `Angular ${expectedH1}`;
@ -7,8 +9,6 @@ const expectedH2 = 'My Heroes';
const targetHero = { id: 16, name: 'RubberMan' };
const nameSuffix = 'X';
type WPromise<T> = webdriver.promise.Promise<T>;
class Hero {
id: number;
name: string;
@ -24,7 +24,7 @@ class Hero {
}
// Get hero id and name from the given detail element.
static async fromDetail(detail: protractor.ElementFinder): Promise<Hero> {
static async fromDetail(detail: ElementFinder): Promise<Hero> {
// Get hero id from the first <div>
let _id = await detail.all(by.css('div')).first().getText();
// Get name from the h2
@ -113,9 +113,9 @@ function updateHeroTests() {
}
function addToHeroName(text: string): WPromise<void> {
function addToHeroName(text: string): promise.Promise<void> {
let input = element(by.css('input'));
return sendKeys(input, text);
return input.sendKeys(text);
}
function expectHeading(hLevel: number, expectedText: string): void {

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder } from 'protractor';
import { promise } from 'selenium-webdriver';
const expectedH1 = 'Tour of Heroes';
const expectedTitle = `Angular ${expectedH1}`;
@ -7,8 +9,6 @@ const expectedH2 = 'My Heroes';
const targetHero = { id: 16, name: 'RubberMan' };
const nameSuffix = 'X';
type WPromise<T> = webdriver.promise.Promise<T>;
class Hero {
id: number;
name: string;
@ -24,7 +24,7 @@ class Hero {
}
// Get hero id and name from the given detail element.
static async fromDetail(detail: protractor.ElementFinder): Promise<Hero> {
static async fromDetail(detail: ElementFinder): Promise<Hero> {
// Get hero id from the first <div>
let _id = await detail.all(by.css('div')).first().getText();
// Get name from the h2
@ -113,9 +113,9 @@ function updateHeroTests() {
}
function addToHeroName(text: string): WPromise<void> {
function addToHeroName(text: string): promise.Promise<void> {
let input = element(by.css('input'));
return sendKeys(input, text);
return input.sendKeys(text);
}
function expectHeading(hLevel: number, expectedText: string): void {

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder } from 'protractor';
import { promise } from 'selenium-webdriver';
const expectedH1 = 'Tour of Heroes';
const expectedTitle = `Angular ${expectedH1}`;
@ -8,8 +10,6 @@ const targetHeroDashboardIndex = 3;
const nameSuffix = 'X';
const newHeroName = targetHero.name + nameSuffix;
type WPromise<T> = webdriver.promise.Promise<T>;
class Hero {
id: number;
name: string;
@ -25,7 +25,7 @@ class Hero {
}
// Get hero id and name from the given detail element.
static async fromDetail(detail: protractor.ElementFinder): Promise<Hero> {
static async fromDetail(detail: ElementFinder): Promise<Hero> {
// Get hero id from the first <div>
let _id = await detail.all(by.css('div')).first().getText();
// Get name from the h2
@ -73,7 +73,7 @@ describe('Tutorial part 5', () => {
const expectedViewNames = ['Dashboard', 'Heroes'];
it(`has views ${expectedViewNames}`, () => {
let viewNames = getPageElts().hrefs.map(el => el.getText());
let viewNames = getPageElts().hrefs.map((el: ElementFinder) => el.getText());
expect(viewNames).toEqual(expectedViewNames);
});
@ -173,9 +173,9 @@ describe('Tutorial part 5', () => {
});
function addToHeroName(text: string): WPromise<void> {
function addToHeroName(text: string): promise.Promise<void> {
let input = element(by.css('input'));
return sendKeys(input, text);
return input.sendKeys(text);
}
function expectHeading(hLevel: number, expectedText: string): void {

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder, ElementArrayFinder } from 'protractor';
import { promise } from 'selenium-webdriver';
const expectedH1 = 'Tour of Heroes';
const expectedTitle = `Angular ${expectedH1}`;
@ -8,8 +10,6 @@ const targetHeroDashboardIndex = 3;
const nameSuffix = 'X';
const newHeroName = targetHero.name + nameSuffix;
type WPromise<T> = webdriver.promise.Promise<T>;
class Hero {
id: number;
name: string;
@ -25,13 +25,13 @@ class Hero {
}
// Hero from hero list <li> element.
static async fromLi(li: protractor.ElementFinder): Promise<Hero> {
static async fromLi(li: ElementFinder): Promise<Hero> {
let strings = await li.all(by.xpath('span')).getText();
return { id: +strings[0], name: strings[1] };
}
// Hero id and name from the given detail element.
static async fromDetail(detail: protractor.ElementFinder): Promise<Hero> {
static async fromDetail(detail: ElementFinder): Promise<Hero> {
// Get hero id from the first <div>
let _id = await detail.all(by.css('div')).first().getText();
// Get name from the h2
@ -82,7 +82,7 @@ describe('Tutorial part 6', () => {
const expectedViewNames = ['Dashboard', 'Heroes'];
it(`has views ${expectedViewNames}`, () => {
let viewNames = getPageElts().hrefs.map(el => el.getText());
let viewNames = getPageElts().hrefs.map((el: ElementFinder) => el.getText());
expect(viewNames).toEqual(expectedViewNames);
});
@ -188,7 +188,7 @@ describe('Tutorial part 6', () => {
const heroesBefore = await toHeroArray(getPageElts().allHeroes);
const numHeroes = heroesBefore.length;
sendKeys(element(by.css('input')), newHeroName);
element(by.css('input')).sendKeys(newHeroName);
element(by.buttonText('Add')).click();
let page = getPageElts();
@ -207,19 +207,19 @@ describe('Tutorial part 6', () => {
beforeAll(() => browser.get(''));
it(`searches for 'Ma'`, async () => {
sendKeys(getPageElts().searchBox, 'Ma');
getPageElts().searchBox.sendKeys('Ma');
browser.sleep(1000);
expect(getPageElts().searchResults.count()).toBe(4);
});
it(`continues search with 'g'`, async () => {
sendKeys(getPageElts().searchBox, 'g');
getPageElts().searchBox.sendKeys('g');
browser.sleep(1000);
expect(getPageElts().searchResults.count()).toBe(2);
});
it(`continues search with 'n' and gets ${targetHero.name}`, async () => {
sendKeys(getPageElts().searchBox, 'n');
getPageElts().searchBox.sendKeys('n');
browser.sleep(1000);
let page = getPageElts();
expect(page.searchResults.count()).toBe(1);
@ -260,9 +260,9 @@ describe('Tutorial part 6', () => {
});
function addToHeroName(text: string): WPromise<void> {
function addToHeroName(text: string): promise.Promise<void> {
let input = element(by.css('input'));
return sendKeys(input, text);
return input.sendKeys(text);
}
function expectHeading(hLevel: number, expectedText: string): void {
@ -271,13 +271,13 @@ function expectHeading(hLevel: number, expectedText: string): void {
expect(hText).toEqual(expectedText, hTag);
};
function getHeroLiEltById(id: number): protractor.ElementFinder {
function getHeroLiEltById(id: number): ElementFinder {
let spanForId = element(by.cssContainingText('li span.badge', id.toString()));
return spanForId.element(by.xpath('..'));
}
async function toHeroArray(allHeroes: protractor.ElementArrayFinder): Promise<Hero[]> {
let promisedHeroes: Array<Promise<Hero>> = await allHeroes.map(Hero.fromLi);
async function toHeroArray(allHeroes: ElementArrayFinder): Promise<Hero[]> {
let promisedHeroes = await allHeroes.map(Hero.fromLi);
// The cast is necessary to get around issuing with the signature of Promise.all()
return <Promise<any>> Promise.all(promisedHeroes);
}

View File

@ -1,6 +1,8 @@
// this tsconfig is used for protractor tests
// see _boilerplate/tsconfig.json for the the tsconfig used in examples
{
"compilerOptions": {
"target": "es5",
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
@ -8,6 +10,15 @@
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
}
}
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"node_modules/@types"
]
},
"files": [
"protractor-helpers.ts"
],
"include": [
"*/e2e-spec.ts"
]
}

View File

@ -1,7 +1,13 @@
{
"globalDependencies": {
"angular": "registry:dt/angular#1.5.0+20160829152510",
"angular-animate": "registry:dt/angular-animate#1.5.0+20160709061515",
"angular-mocks": "registry:dt/angular-mocks#1.5.0+20160608104721",
"angular-resource": "registry:dt/angular-resource#1.5.0+20160613142217",
"angular-route": "registry:dt/angular-route#1.3.0+20160317120654",
"core-js": "registry:dt/core-js#0.0.0+20160725163759",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"jquery": "registry:dt/jquery#1.10.0+20160704162008",
"node": "registry:dt/node#6.0.0+20160909174046"
}
}

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('Upgrade Tests', function () {
// Protractor doesn't support the UpgradeAdapter's asynchronous

View File

@ -12,9 +12,6 @@ The following changes from vanilla Phonecat are applied:
in index.html and karma.conf.ng1.js.
* E2E tests have been moved to the parent directory, where `gulp run-e2e-tests` can
discover and run them along with all the other examples.
* Angular 1 typings (from DefinitelyTyped) are added to typings-ng1 so that
TypeScript can recognize Angular 1 code. (typings.json comes from boilerplate
so we can't add them there).
* Most of the phone JSON and image data removed in the interest of keeping
repo weight down. Keeping enough to retain testability of the app.

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder } from 'protractor';
import { setProtractorToNg1Mode } from '../protractor-helpers';
// Angular E2E Testing Guide:
// https://docs.angularjs.org/guide/e2e-testing
@ -43,7 +45,7 @@ describe('PhoneCat Application', function() {
let phoneNameColumn = element.all(by.repeater('phone in $ctrl.phones').column('phone.name'));
function getNames() {
return phoneNameColumn.map(function(elem) {
return phoneNameColumn.map(function(elem: ElementFinder) {
return elem.getText();
});
}

View File

@ -1,294 +0,0 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/f0b2681b481397d0c03557ac2ac4d70c1c61c464/angularjs/angular-animate.d.ts
declare module "angular-animate" {
var _: string;
export = _;
}
/**
* ngAnimate module (angular-animate.js)
*/
declare namespace angular.animate {
interface IAnimateFactory {
(...args: any[]): IAnimateCallbackObject;
}
interface IAnimateCallbackObject {
eventFn?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
setClass?: (element: IAugmentedJQuery, addedClasses: string, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
addClass?: (element: IAugmentedJQuery, addedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
removeClass?: (element: IAugmentedJQuery, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
enter?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
leave?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
move?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
animate?: (element: IAugmentedJQuery, fromStyles: string, toStyles: string, doneFunction: Function, options: IAnimationOptions) => any;
}
interface IAnimationPromise extends IPromise<void> {}
/**
* AnimateService
* see http://docs.angularjs.org/api/ngAnimate/service/$animate
*/
interface IAnimateService {
/**
* Sets up an event listener to fire whenever the animation event has fired on the given element or among any of its children.
*
* @param event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...)
* @param container the container element that will capture each of the animation events that are fired on itself as well as among its children
* @param callback the callback function that will be fired when the listener is triggered
*/
on(event: string, container: JQuery, callback: Function): void;
/**
* Deregisters an event listener based on the event which has been associated with the provided element.
*
* @param event the animation event (e.g. enter, leave, move, addClass, removeClass, etc...)
* @param container the container element the event listener was placed on
* @param callback the callback function that was registered as the listener
*/
off(event: string, container?: JQuery, callback?: Function): void;
/**
* Associates the provided element with a host parent element to allow the element to be animated even if it exists outside of the DOM structure of the Angular application.
*
* @param element the external element that will be pinned
* @param parentElement the host parent element that will be associated with the external element
*/
pin(element: JQuery, parentElement: JQuery): void;
/**
* Globally enables / disables animations.
*
* @param element If provided then the element will be used to represent the enable/disable operation.
* @param value If provided then set the animation on or off.
* @returns current animation state
*/
enabled(element: JQuery, value?: boolean): boolean;
enabled(value: boolean): boolean;
/**
* Cancels the provided animation.
*/
cancel(animationPromise: IAnimationPromise): void;
/**
* Performs an inline animation on the element.
*
* @param element the element that will be the focus of the animation
* @param from a collection of CSS styles that will be applied to the element at the start of the animation
* @param to a collection of CSS styles that the element will animate towards
* @param className an optional CSS class that will be added to the element for the duration of the animation (the default class is 'ng-inline-animate')
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
* @returns the animation callback promise
*/
animate(element: JQuery, from: any, to: any, className?: string, options?: IAnimationOptions): IAnimationPromise;
/**
* Appends the element to the parentElement element that resides in the document and then runs the enter animation.
*
* @param element the element that will be the focus of the enter animation
* @param parentElement the parent element of the element that will be the focus of the enter animation
* @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
* @returns the animation callback promise
*/
enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery, options?: IAnimationOptions): IAnimationPromise;
/**
* Runs the leave animation operation and, upon completion, removes the element from the DOM.
*
* @param element the element that will be the focus of the leave animation
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
* @returns the animation callback promise
*/
leave(element: JQuery, options?: IAnimationOptions): IAnimationPromise;
/**
* Fires the move DOM operation. Just before the animation starts, the animate service will either append
* it into the parentElement container or add the element directly after the afterElement element if present.
* Then the move animation will be run.
*
* @param element the element that will be the focus of the move animation
* @param parentElement the parent element of the element that will be the focus of the move animation
* @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation
* @returns the animation callback promise
*/
move(element: JQuery, parentElement: JQuery, afterElement?: JQuery): IAnimationPromise;
/**
* Triggers a custom animation event based off the className variable and then attaches the className
* value to the element as a CSS class.
*
* @param element the element that will be animated
* @param className the CSS class that will be added to the element and then animated
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
* @returns the animation callback promise
*/
addClass(element: JQuery, className: string, options?: IAnimationOptions): IAnimationPromise;
/**
* Triggers a custom animation event based off the className variable and then removes the CSS class
* provided by the className value from the element.
*
* @param element the element that will be animated
* @param className the CSS class that will be animated and then removed from the element
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
* @returns the animation callback promise
*/
removeClass(element: JQuery, className: string, options?: IAnimationOptions): IAnimationPromise;
/**
* Adds and/or removes the given CSS classes to and from the element. Once complete, the done() callback
* will be fired (if provided).
*
* @param element the element which will have its CSS classes changed removed from it
* @param add the CSS classes which will be added to the element
* @param remove the CSS class which will be removed from the element CSS classes have been set on the element
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
* @returns the animation callback promise
*/
setClass(element: JQuery, add: string, remove: string, options?: IAnimationOptions): IAnimationPromise;
}
/**
* AnimateProvider
* see http://docs.angularjs.org/api/ngAnimate/provider/$animateProvider
*/
interface IAnimateProvider {
/**
* Registers a new injectable animation factory function.
*
* @param name The name of the animation.
* @param factory The factory function that will be executed to return the animation object.
*/
register(name: string, factory: IAnimateFactory): void;
/**
* Gets and/or sets the CSS class expression that is checked when performing an animation.
*
* @param expression The className expression which will be checked against all animations.
* @returns The current CSS className expression value. If null then there is no expression value.
*/
classNameFilter(expression?: RegExp): RegExp;
}
/**
* Angular Animation Options
* see https://docs.angularjs.org/api/ngAnimate/#applying-directive-specific-styles-to-an-animation
*/
interface IAnimationOptions {
/**
* The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition.
*/
to?: Object;
/**
* The starting CSS styles (a key/value object) that will be applied at the start of the animation.
*/
from?: Object;
/**
* The DOM event (e.g. enter, leave, move). When used, a generated CSS class of ng-EVENT and
* ng-EVENT-active will be applied to the element during the animation. Multiple events can be provided when
* spaces are used as a separator. (Note that this will not perform any DOM operation.)
*/
event?: string;
/**
* The CSS easing value that will be applied to the transition or keyframe animation (or both).
*/
easing?: string;
/**
* The raw CSS transition style that will be used (e.g. 1s linear all).
*/
transition?: string;
/**
* The raw CSS keyframe animation style that will be used (e.g. 1s my_animation linear).
*/
keyframe?: string;
/**
* A space separated list of CSS classes that will be added to the element and spread across the animation.
*/
addClass?: string;
/**
* A space separated list of CSS classes that will be removed from the element and spread across
* the animation.
*/
removeClass?: string;
/**
* A number value representing the total duration of the transition and/or keyframe (note that a value
* of 1 is 1000ms). If a value of 0 is provided then the animation will be skipped entirely.
*/
duration?: number;
/**
* A number value representing the total delay of the transition and/or keyframe (note that a value of
* 1 is 1000ms). If a value of true is used then whatever delay value is detected from the CSS classes will be
* mirrored on the elements styles (e.g. by setting delay true then the style value of the element will be
* transition-delay: DETECTED_VALUE). Using true is useful when you want the CSS classes and inline styles to
* all share the same CSS delay value.
*/
delay?: number;
/**
* A numeric time value representing the delay between successively animated elements (Click here to
* learn how CSS-based staggering works in ngAnimate.)
*/
stagger?: number;
/**
* The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item
* in the stagger; therefore when a stagger option value of 0.1 is used then there will be a stagger delay of 600ms)
* applyClassesEarly - Whether or not the classes being added or removed will be used when detecting the animation.
* This is set by $animate when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time.
* (Note that this will prevent any transitions from occuring on the classes being added and removed.)
*/
staggerIndex?: number;
}
interface IAnimateCssRunner {
/**
* Starts the animation
*
* @returns The animation runner with a done function for supplying a callback.
*/
start(): IAnimateCssRunnerStart;
/**
* Ends (aborts) the animation
*/
end(): void;
}
interface IAnimateCssRunnerStart extends IPromise<void> {
/**
* Allows you to add done callbacks to the running animation
*
* @param callbackFn: the callback function to be run
*/
done(callbackFn: (animationFinished: boolean) => void): void;
}
/**
* AnimateCssService
* see http://docs.angularjs.org/api/ngAnimate/service/$animateCss
*/
interface IAnimateCssService {
(element: JQuery, animateCssOptions: IAnimationOptions): IAnimateCssRunner;
}
}
declare module angular {
interface IModule {
animation(name: string, animationFactory: angular.animate.IAnimateFactory): IModule;
animation(name: string, inlineAnnotatedFunction: any[]): IModule;
animation(object: Object): IModule;
}
}

View File

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/f0b2681b481397d0c03557ac2ac4d70c1c61c464/angularjs/angular-animate.d.ts",
"raw": "registry:dt/angular-animate#1.5.0+20160407085121",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/f0b2681b481397d0c03557ac2ac4d70c1c61c464/angularjs/angular-animate.d.ts"
}
}

View File

@ -1,339 +0,0 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5b7257019ae959533341a715b339d2562bbf9b85/angularjs/angular-mocks.d.ts
declare module "angular-mocks/ngMock" {
var _: string;
export = _;
}
declare module "angular-mocks/ngMockE2E" {
var _: string;
export = _;
}
declare module "angular-mocks/ngAnimateMock" {
var _: string;
export = _;
}
///////////////////////////////////////////////////////////////////////////////
// ngMock module (angular-mocks.js)
///////////////////////////////////////////////////////////////////////////////
declare namespace angular {
///////////////////////////////////////////////////////////////////////////
// AngularStatic
// We reopen it to add the MockStatic definition
///////////////////////////////////////////////////////////////////////////
interface IAngularStatic {
mock: IMockStatic;
}
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.inject
interface IInjectStatic {
(...fns: Function[]): any;
(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works
strictDi(val?: boolean): void;
}
interface IMockStatic {
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.dump
dump(obj: any): string;
inject: IInjectStatic
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.module
module: {
(...modules: any[]): any;
sharedInjector(): void;
}
// see https://docs.angularjs.org/api/ngMock/type/angular.mock.TzDate
TzDate(offset: number, timestamp: number): Date;
TzDate(offset: number, timestamp: string): Date;
}
///////////////////////////////////////////////////////////////////////////
// ExceptionHandlerService
// see https://docs.angularjs.org/api/ngMock/service/$exceptionHandler
// see https://docs.angularjs.org/api/ngMock/provider/$exceptionHandlerProvider
///////////////////////////////////////////////////////////////////////////
interface IExceptionHandlerProvider extends IServiceProvider {
mode(mode: string): void;
}
///////////////////////////////////////////////////////////////////////////
// TimeoutService
// see https://docs.angularjs.org/api/ngMock/service/$timeout
// Augments the original service
///////////////////////////////////////////////////////////////////////////
interface ITimeoutService {
flush(delay?: number): void;
flushNext(expectedDelay?: number): void;
verifyNoPendingTasks(): void;
}
///////////////////////////////////////////////////////////////////////////
// IntervalService
// see https://docs.angularjs.org/api/ngMock/service/$interval
// Augments the original service
///////////////////////////////////////////////////////////////////////////
interface IIntervalService {
flush(millis?: number): number;
}
///////////////////////////////////////////////////////////////////////////
// LogService
// see https://docs.angularjs.org/api/ngMock/service/$log
// Augments the original service
///////////////////////////////////////////////////////////////////////////
interface ILogService {
assertEmpty(): void;
reset(): void;
}
interface ILogCall {
logs: string[];
}
///////////////////////////////////////////////////////////////////////////
// ControllerService mock
// see https://docs.angularjs.org/api/ngMock/service/$controller
// This interface extends http://docs.angularjs.org/api/ng.$controller
///////////////////////////////////////////////////////////////////////////
interface IControllerService {
// Although the documentation doesn't state this, locals are optional
<T>(controllerConstructor: new (...args: any[]) => T, locals?: any, bindings?: any): T;
<T>(controllerConstructor: Function, locals?: any, bindings?: any): T;
<T>(controllerName: string, locals?: any, bindings?: any): T;
}
///////////////////////////////////////////////////////////////////////////
// ComponentControllerService
// see https://docs.angularjs.org/api/ngMock/service/$componentController
///////////////////////////////////////////////////////////////////////////
interface IComponentControllerService {
// TBinding is an interface exposed by a component as per John Papa's style guide
// https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#accessible-members-up-top
<T, TBinding>(componentName: string, locals: { $scope: IScope, [key: string]: any }, bindings?: TBinding, ident?: string): T;
}
///////////////////////////////////////////////////////////////////////////
// HttpBackendService
// see https://docs.angularjs.org/api/ngMock/service/$httpBackend
///////////////////////////////////////////////////////////////////////////
interface IHttpBackendService {
/**
* Flushes all pending requests using the trained responses.
* @param count Number of responses to flush (in the order they arrived). If undefined, all pending requests will be flushed.
*/
flush(count?: number): void;
/**
* Resets all request expectations, but preserves all backend definitions.
*/
resetExpectations(): void;
/**
* Verifies that all of the requests defined via the expect api were made. If any of the requests were not made, verifyNoOutstandingExpectation throws an exception.
*/
verifyNoOutstandingExpectation(): void;
/**
* Verifies that there are no outstanding requests that need to be flushed.
*/
verifyNoOutstandingRequest(): void;
/**
* Creates a new request expectation.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param method HTTP method.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)) :mock.IRequestHandler;
/**
* Creates a new request expectation for DELETE requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected.
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
*/
expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
/**
* Creates a new request expectation for GET requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
*/
expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
/**
* Creates a new request expectation for HEAD requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
*/
expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
/**
* Creates a new request expectation for JSONP requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
*/
expectJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler;
/**
* Creates a new request expectation for PATCH requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
/**
* Creates a new request expectation for POST requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
/**
* Creates a new request expectation for PUT requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
/**
* Creates a new backend definition.
* Returns an object with respond method that controls how a matched request is handled.
* @param method HTTP method.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
/**
* Creates a new backend definition for DELETE requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
/**
* Creates a new backend definition for GET requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
/**
* Creates a new backend definition for HEAD requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
/**
* Creates a new backend definition for JSONP requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
whenJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler;
/**
* Creates a new backend definition for PATCH requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
/**
* Creates a new backend definition for POST requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
/**
* Creates a new backend definition for PUT requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
}
export module mock {
// returned interface by the the mocked HttpBackendService expect/when methods
interface IRequestHandler {
/**
* Controls the response for a matched request using a function to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param func Function that receives the request HTTP method, url, data, and headers and returns an array containing response status (number), data, headers, and status text.
*/
respond(func: ((method: string, url: string, data: string | Object, headers: Object) => [number, string | Object, Object, string])): IRequestHandler;
/**
* Controls the response for a matched request using supplied static data to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param status HTTP status code to add to the response.
* @param data Data to add to the response.
* @param headers Headers object to add to the response.
* @param responseText Response text to add to the response.
*/
respond(status: number, data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
/**
* Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param data Data to add to the response.
* @param headers Headers object to add to the response.
* @param responseText Response text to add to the response.
*/
respond(data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
// Available when ngMockE2E is loaded
/**
* Any request matching a backend definition or expectation with passThrough handler will be passed through to the real backend (an XHR request will be made to the server.)
*/
passThrough(): IRequestHandler;
}
}
}
///////////////////////////////////////////////////////////////////////////////
// functions attached to global object (window)
///////////////////////////////////////////////////////////////////////////////
//Use `angular.mock.module` instead of `module`, as `module` conflicts with commonjs.
//declare var module: (...modules: any[]) => any;
declare var inject: angular.IInjectStatic;

View File

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5b7257019ae959533341a715b339d2562bbf9b85/angularjs/angular-mocks.d.ts",
"raw": "registry:dt/angular-mocks#1.3.0+20160425155016",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5b7257019ae959533341a715b339d2562bbf9b85/angularjs/angular-mocks.d.ts"
}
}

View File

@ -1,191 +0,0 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/e684481e0cd360db62fd6213ca7248245315e8a2/angularjs/angular-resource.d.ts
declare module 'angular-resource' {
var _: string;
export = _;
}
///////////////////////////////////////////////////////////////////////////////
// ngResource module (angular-resource.js)
///////////////////////////////////////////////////////////////////////////////
declare namespace angular.resource {
/**
* Currently supported options for the $resource factory options argument.
*/
interface IResourceOptions {
/**
* If true then the trailing slashes from any calculated URL will be stripped (defaults to true)
*/
stripTrailingSlashes?: boolean;
/**
* If true, the request made by a "non-instance" call will be cancelled (if not already completed) by calling
* $cancelRequest() on the call's return value. This can be overwritten per action. (Defaults to false.)
*/
cancellable?: boolean;
}
///////////////////////////////////////////////////////////////////////////
// ResourceService
// see http://docs.angularjs.org/api/ngResource.$resource
// Most part of the following definitions were achieved by analyzing the
// actual implementation, since the documentation doesn't seem to cover
// that deeply.
///////////////////////////////////////////////////////////////////////////
interface IResourceService {
(url: string, paramDefaults?: any,
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
where deleteDescriptor : IActionDescriptor */
actions?: any, options?: IResourceOptions): IResourceClass<IResource<any>>;
<T, U>(url: string, paramDefaults?: any,
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
where deleteDescriptor : IActionDescriptor */
actions?: any, options?: IResourceOptions): U;
<T>(url: string, paramDefaults?: any,
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
where deleteDescriptor : IActionDescriptor */
actions?: any, options?: IResourceOptions): IResourceClass<T>;
}
// Just a reference to facilitate describing new actions
interface IActionDescriptor {
method: string;
params?: any;
url?: string;
isArray?: boolean;
transformRequest?: angular.IHttpRequestTransformer | angular.IHttpRequestTransformer[];
transformResponse?: angular.IHttpResponseTransformer | angular.IHttpResponseTransformer[];
headers?: any;
cache?: boolean | angular.ICacheObject;
/**
* Note: In contrast to $http.config, promises are not supported in $resource, because the same value
* would be used for multiple requests. If you are looking for a way to cancel requests, you should
* use the cancellable option.
*/
timeout?: number
cancellable?: boolean;
withCredentials?: boolean;
responseType?: string;
interceptor?: IHttpInterceptor;
}
// Allow specify more resource methods
// No need to add duplicates for all four overloads.
interface IResourceMethod<T> {
(): T;
(params: Object): T;
(success: Function, error?: Function): T;
(params: Object, success: Function, error?: Function): T;
(params: Object, data: Object, success?: Function, error?: Function): T;
}
// Allow specify resource moethod which returns the array
// No need to add duplicates for all four overloads.
interface IResourceArrayMethod<T> {
(): IResourceArray<T>;
(params: Object): IResourceArray<T>;
(success: Function, error?: Function): IResourceArray<T>;
(params: Object, success: Function, error?: Function): IResourceArray<T>;
(params: Object, data: Object, success?: Function, error?: Function): IResourceArray<T>;
}
// Baseclass for everyresource with default actions.
// If you define your new actions for the resource, you will need
// to extend this interface and typecast the ResourceClass to it.
//
// In case of passing the first argument as anything but a function,
// it's gonna be considered data if the action method is POST, PUT or
// PATCH (in other words, methods with body). Otherwise, it's going
// to be considered as parameters to the request.
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L461-L465
//
// Only those methods with an HTTP body do have 'data' as first parameter:
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L463
// More specifically, those methods are POST, PUT and PATCH:
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L432
//
// Also, static calls always return the IResource (or IResourceArray) retrieved
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L549
interface IResourceClass<T> {
new(dataOrParams? : any) : T;
get: IResourceMethod<T>;
query: IResourceArrayMethod<T>;
save: IResourceMethod<T>;
remove: IResourceMethod<T>;
delete: IResourceMethod<T>;
}
// Instance calls always return the the promise of the request which retrieved the object
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L546
interface IResource<T> {
$get(): angular.IPromise<T>;
$get(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
$get(success: Function, error?: Function): angular.IPromise<T>;
$query(): angular.IPromise<IResourceArray<T>>;
$query(params?: Object, success?: Function, error?: Function): angular.IPromise<IResourceArray<T>>;
$query(success: Function, error?: Function): angular.IPromise<IResourceArray<T>>;
$save(): angular.IPromise<T>;
$save(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
$save(success: Function, error?: Function): angular.IPromise<T>;
$remove(): angular.IPromise<T>;
$remove(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
$remove(success: Function, error?: Function): angular.IPromise<T>;
$delete(): angular.IPromise<T>;
$delete(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
$delete(success: Function, error?: Function): angular.IPromise<T>;
$cancelRequest(): void;
/** the promise of the original server interaction that created this instance. **/
$promise : angular.IPromise<T>;
$resolved : boolean;
toJSON(): T;
}
/**
* Really just a regular Array object with $promise and $resolve attached to it
*/
interface IResourceArray<T> extends Array<T & IResource<T>> {
/** the promise of the original server interaction that created this collection. **/
$promise : angular.IPromise<IResourceArray<T>>;
$resolved : boolean;
}
/** when creating a resource factory via IModule.factory */
interface IResourceServiceFactoryFunction<T> {
($resource: angular.resource.IResourceService): IResourceClass<T>;
<U extends IResourceClass<T>>($resource: angular.resource.IResourceService): U;
}
// IResourceServiceProvider used to configure global settings
interface IResourceServiceProvider extends angular.IServiceProvider {
defaults: IResourceOptions;
}
}
/** extensions to base ng based on using angular-resource */
declare namespace angular {
interface IModule {
/** creating a resource service factory */
factory(name: string, resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction<any>): IModule;
}
}
interface Array<T>
{
/** the promise of the original server interaction that created this collection. **/
$promise : angular.IPromise<Array<T>>;
$resolved : boolean;
}

View File

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/e684481e0cd360db62fd6213ca7248245315e8a2/angularjs/angular-resource.d.ts",
"raw": "registry:dt/angular-resource#1.5.0+20160412142209",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/e684481e0cd360db62fd6213ca7248245315e8a2/angularjs/angular-resource.d.ts"
}
}

View File

@ -1,154 +0,0 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/angularjs/angular-route.d.ts
declare module "angular-route" {
var _: string;
export = _;
}
///////////////////////////////////////////////////////////////////////////////
// ngRoute module (angular-route.js)
///////////////////////////////////////////////////////////////////////////////
declare namespace angular.route {
///////////////////////////////////////////////////////////////////////////
// RouteParamsService
// see http://docs.angularjs.org/api/ngRoute.$routeParams
///////////////////////////////////////////////////////////////////////////
interface IRouteParamsService {
[key: string]: any;
}
///////////////////////////////////////////////////////////////////////////
// RouteService
// see http://docs.angularjs.org/api/ngRoute.$route
// see http://docs.angularjs.org/api/ngRoute.$routeProvider
///////////////////////////////////////////////////////////////////////////
interface IRouteService {
reload(): void;
routes: any;
// May not always be available. For instance, current will not be available
// to a controller that was not initialized as a result of a route maching.
current?: ICurrentRoute;
/**
* Causes $route service to update the current URL, replacing current route parameters with those specified in newParams.
* Provided property names that match the route's path segment definitions will be interpolated into the
* location's path, while remaining properties will be treated as query params.
*
* @param newParams Object.<string, string> mapping of URL parameter names to values
*/
updateParams(newParams:{[key:string]:string}): void;
}
type InlineAnnotatedFunction = Function|Array<string|Function>
/**
* see http://docs.angularjs.org/api/ngRoute/provider/$routeProvider#when for API documentation
*/
interface IRoute {
/**
* {(string|function()=}
* Controller fn that should be associated with newly created scope or the name of a registered controller if passed as a string.
*/
controller?: string|InlineAnnotatedFunction;
/**
* A controller alias name. If present the controller will be published to scope under the controllerAs name.
*/
controllerAs?: string;
/**
* Undocumented?
*/
name?: string;
/**
* {string=|function()=}
* Html template as a string or a function that returns an html template as a string which should be used by ngView or ngInclude directives. This property takes precedence over templateUrl.
*
* If template is a function, it will be called with the following parameters:
*
* {Array.<Object>} - route parameters extracted from the current $location.path() by applying the current route
*/
template?: string|{($routeParams?: angular.route.IRouteParamsService) : string;}
/**
* {string=|function()=}
* Path or function that returns a path to an html template that should be used by ngView.
*
* If templateUrl is a function, it will be called with the following parameters:
*
* {Array.<Object>} - route parameters extracted from the current $location.path() by applying the current route
*/
templateUrl?: string|{ ($routeParams?: angular.route.IRouteParamsService): string; }
/**
* {Object.<string, function>=} - An optional map of dependencies which should be injected into the controller. If any of these dependencies are promises, the router will wait for them all to be resolved or one to be rejected before the controller is instantiated. If all the promises are resolved successfully, the values of the resolved promises are injected and $routeChangeSuccess event is fired. If any of the promises are rejected the $routeChangeError event is fired. The map object is:
*
* - key - {string}: a name of a dependency to be injected into the controller.
* - factory - {string|function}: If string then it is an alias for a service. Otherwise if function, then it is injected and the return value is treated as the dependency. If the result is a promise, it is resolved before its value is injected into the controller. Be aware that ngRoute.$routeParams will still refer to the previous route within these resolve functions. Use $route.current.params to access the new route parameters, instead.
*/
resolve?: {[key: string]: any};
/**
* {(string|function())=}
* Value to update $location path with and trigger route redirection.
*
* If redirectTo is a function, it will be called with the following parameters:
*
* - {Object.<string>} - route parameters extracted from the current $location.path() by applying the current route templateUrl.
* - {string} - current $location.path()
* - {Object} - current $location.search()
* - The custom redirectTo function is expected to return a string which will be used to update $location.path() and $location.search().
*/
redirectTo?: string|{($routeParams?: angular.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any) : string};
/**
* Reload route when only $location.search() or $location.hash() changes.
*
* This option defaults to true. If the option is set to false and url in the browser changes, then $routeUpdate event is broadcasted on the root scope.
*/
reloadOnSearch?: boolean;
/**
* Match routes without being case sensitive
*
* This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive
*/
caseInsensitiveMatch?: boolean;
}
// see http://docs.angularjs.org/api/ng.$route#current
interface ICurrentRoute extends IRoute {
locals: {
[index: string]: any;
$scope: IScope;
$template: string;
};
params: any;
}
interface IRouteProvider extends IServiceProvider {
/**
* Match routes without being case sensitive
*
* This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive
*/
caseInsensitiveMatch?: boolean;
/**
* Sets route definition that will be used on route change when no other route definition is matched.
*
* @params Mapping information to be assigned to $route.current.
*/
otherwise(params: IRoute): IRouteProvider;
/**
* Adds a new route definition to the $route service.
*
* @param path Route path (matched against $location.path). If $location.path contains redundant trailing slash or is missing one, the route will still match and the $location.path will be updated to add or drop the trailing slash to exactly match the route definition.
*
* - path can contain named groups starting with a colon: e.g. :name. All characters up to the next slash are matched and stored in $routeParams under the given name when the route matches.
* - path can contain named groups starting with a colon and ending with a star: e.g.:name*. All characters are eagerly stored in $routeParams under the given name when the route matches.
* - path can contain optional named groups with a question mark: e.g.:name?.
*
* For example, routes like /color/:color/largecode/:largecode*\/edit will match /color/brown/largecode/code/with/slashes/edit and extract: color: brown and largecode: code/with/slashes.
*
* @param route Mapping information to be assigned to $route.current on route match.
*/
when(path: string, route: IRoute): IRouteProvider;
}
}

View File

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/angularjs/angular-route.d.ts",
"raw": "registry:dt/angular-route#1.3.0+20160317120654",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/angularjs/angular-route.d.ts"
}
}

View File

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b76dd8a7f95b71696982befbb7589940d27e940b/angularjs/angular.d.ts",
"raw": "registry:dt/angular#1.5.0+20160517064839",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b76dd8a7f95b71696982befbb7589940d27e940b/angularjs/angular.d.ts"
}
}

View File

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/4cdfbe96b666eec5e1defbb519a62abf04e96764/jquery/jquery.d.ts",
"raw": "registry:dt/jquery#1.10.0+20160417213236",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/4cdfbe96b666eec5e1defbb519a62abf04e96764/jquery/jquery.d.ts"
}
}

View File

@ -1,6 +0,0 @@
/// <reference path="globals/angular-animate/index.d.ts" />
/// <reference path="globals/angular-mocks/index.d.ts" />
/// <reference path="globals/angular-resource/index.d.ts" />
/// <reference path="globals/angular-route/index.d.ts" />
/// <reference path="globals/angular/index.d.ts" />
/// <reference path="globals/jquery/index.d.ts" />

View File

@ -14,9 +14,6 @@ The following changes from vanilla Phonecat are applied:
in index.html and karma.conf.ng1.js.
* E2E tests have been moved to the parent directory, where `run-e2e-tests` can
discover and run them along with all the other examples.
* Angular 1 typings (from DefinitelyTyped) are added to typings-ng1 so that
TypeScript can recognize Angular 1 code. (typings.json comes from boilerplate
so we can't add them there).
* Most of the phone JSON and image data removed in the interest of keeping
repo weight down. Keeping enough to retain testability of the app.

View File

@ -1,5 +1,6 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
// Angular E2E Testing Guide:
// https://docs.angularjs.org/guide/e2e-testing
@ -27,11 +28,11 @@ describe('PhoneCat Application', function() {
expect(phoneList.count()).toBe(20);
sendKeys(query, 'nexus');
query.sendKeys('nexus');
expect(phoneList.count()).toBe(1);
query.clear();
sendKeys(query, 'motorola');
query.sendKeys('motorola');
expect(phoneList.count()).toBe(8);
});
@ -47,7 +48,7 @@ describe('PhoneCat Application', function() {
});
}
sendKeys(queryField, 'tablet'); // Let's narrow the dataset to make the assertions shorter
queryField.sendKeys('tablet'); // Let's narrow the dataset to make the assertions shorter
expect(getNames()).toEqual([
'Motorola XOOM\u2122 with Wi-Fi',
@ -64,7 +65,7 @@ describe('PhoneCat Application', function() {
it('should render phone specific links', function() {
let query = element(by.css('input'));
sendKeys(query, 'nexus');
query.sendKeys('nexus');
element.all(by.css('.phones li a')).first().click();
browser.refresh(); // Not sure why this is needed but it is. The route change works fine.

View File

@ -1,294 +0,0 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/f0b2681b481397d0c03557ac2ac4d70c1c61c464/angularjs/angular-animate.d.ts
declare module "angular-animate" {
var _: string;
export = _;
}
/**
* ngAnimate module (angular-animate.js)
*/
declare namespace angular.animate {
interface IAnimateFactory {
(...args: any[]): IAnimateCallbackObject;
}
interface IAnimateCallbackObject {
eventFn?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
setClass?: (element: IAugmentedJQuery, addedClasses: string, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
addClass?: (element: IAugmentedJQuery, addedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
removeClass?: (element: IAugmentedJQuery, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any;
enter?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
leave?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
move?: (element: IAugmentedJQuery, doneFunction: Function, options: IAnimationOptions) => any;
animate?: (element: IAugmentedJQuery, fromStyles: string, toStyles: string, doneFunction: Function, options: IAnimationOptions) => any;
}
interface IAnimationPromise extends IPromise<void> {}
/**
* AnimateService
* see http://docs.angularjs.org/api/ngAnimate/service/$animate
*/
interface IAnimateService {
/**
* Sets up an event listener to fire whenever the animation event has fired on the given element or among any of its children.
*
* @param event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...)
* @param container the container element that will capture each of the animation events that are fired on itself as well as among its children
* @param callback the callback function that will be fired when the listener is triggered
*/
on(event: string, container: JQuery, callback: Function): void;
/**
* Deregisters an event listener based on the event which has been associated with the provided element.
*
* @param event the animation event (e.g. enter, leave, move, addClass, removeClass, etc...)
* @param container the container element the event listener was placed on
* @param callback the callback function that was registered as the listener
*/
off(event: string, container?: JQuery, callback?: Function): void;
/**
* Associates the provided element with a host parent element to allow the element to be animated even if it exists outside of the DOM structure of the Angular application.
*
* @param element the external element that will be pinned
* @param parentElement the host parent element that will be associated with the external element
*/
pin(element: JQuery, parentElement: JQuery): void;
/**
* Globally enables / disables animations.
*
* @param element If provided then the element will be used to represent the enable/disable operation.
* @param value If provided then set the animation on or off.
* @returns current animation state
*/
enabled(element: JQuery, value?: boolean): boolean;
enabled(value: boolean): boolean;
/**
* Cancels the provided animation.
*/
cancel(animationPromise: IAnimationPromise): void;
/**
* Performs an inline animation on the element.
*
* @param element the element that will be the focus of the animation
* @param from a collection of CSS styles that will be applied to the element at the start of the animation
* @param to a collection of CSS styles that the element will animate towards
* @param className an optional CSS class that will be added to the element for the duration of the animation (the default class is 'ng-inline-animate')
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
* @returns the animation callback promise
*/
animate(element: JQuery, from: any, to: any, className?: string, options?: IAnimationOptions): IAnimationPromise;
/**
* Appends the element to the parentElement element that resides in the document and then runs the enter animation.
*
* @param element the element that will be the focus of the enter animation
* @param parentElement the parent element of the element that will be the focus of the enter animation
* @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
* @returns the animation callback promise
*/
enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery, options?: IAnimationOptions): IAnimationPromise;
/**
* Runs the leave animation operation and, upon completion, removes the element from the DOM.
*
* @param element the element that will be the focus of the leave animation
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
* @returns the animation callback promise
*/
leave(element: JQuery, options?: IAnimationOptions): IAnimationPromise;
/**
* Fires the move DOM operation. Just before the animation starts, the animate service will either append
* it into the parentElement container or add the element directly after the afterElement element if present.
* Then the move animation will be run.
*
* @param element the element that will be the focus of the move animation
* @param parentElement the parent element of the element that will be the focus of the move animation
* @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation
* @returns the animation callback promise
*/
move(element: JQuery, parentElement: JQuery, afterElement?: JQuery): IAnimationPromise;
/**
* Triggers a custom animation event based off the className variable and then attaches the className
* value to the element as a CSS class.
*
* @param element the element that will be animated
* @param className the CSS class that will be added to the element and then animated
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
* @returns the animation callback promise
*/
addClass(element: JQuery, className: string, options?: IAnimationOptions): IAnimationPromise;
/**
* Triggers a custom animation event based off the className variable and then removes the CSS class
* provided by the className value from the element.
*
* @param element the element that will be animated
* @param className the CSS class that will be animated and then removed from the element
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
* @returns the animation callback promise
*/
removeClass(element: JQuery, className: string, options?: IAnimationOptions): IAnimationPromise;
/**
* Adds and/or removes the given CSS classes to and from the element. Once complete, the done() callback
* will be fired (if provided).
*
* @param element the element which will have its CSS classes changed removed from it
* @param add the CSS classes which will be added to the element
* @param remove the CSS class which will be removed from the element CSS classes have been set on the element
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
* @returns the animation callback promise
*/
setClass(element: JQuery, add: string, remove: string, options?: IAnimationOptions): IAnimationPromise;
}
/**
* AnimateProvider
* see http://docs.angularjs.org/api/ngAnimate/provider/$animateProvider
*/
interface IAnimateProvider {
/**
* Registers a new injectable animation factory function.
*
* @param name The name of the animation.
* @param factory The factory function that will be executed to return the animation object.
*/
register(name: string, factory: IAnimateFactory): void;
/**
* Gets and/or sets the CSS class expression that is checked when performing an animation.
*
* @param expression The className expression which will be checked against all animations.
* @returns The current CSS className expression value. If null then there is no expression value.
*/
classNameFilter(expression?: RegExp): RegExp;
}
/**
* Angular Animation Options
* see https://docs.angularjs.org/api/ngAnimate/#applying-directive-specific-styles-to-an-animation
*/
interface IAnimationOptions {
/**
* The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition.
*/
to?: Object;
/**
* The starting CSS styles (a key/value object) that will be applied at the start of the animation.
*/
from?: Object;
/**
* The DOM event (e.g. enter, leave, move). When used, a generated CSS class of ng-EVENT and
* ng-EVENT-active will be applied to the element during the animation. Multiple events can be provided when
* spaces are used as a separator. (Note that this will not perform any DOM operation.)
*/
event?: string;
/**
* The CSS easing value that will be applied to the transition or keyframe animation (or both).
*/
easing?: string;
/**
* The raw CSS transition style that will be used (e.g. 1s linear all).
*/
transition?: string;
/**
* The raw CSS keyframe animation style that will be used (e.g. 1s my_animation linear).
*/
keyframe?: string;
/**
* A space separated list of CSS classes that will be added to the element and spread across the animation.
*/
addClass?: string;
/**
* A space separated list of CSS classes that will be removed from the element and spread across
* the animation.
*/
removeClass?: string;
/**
* A number value representing the total duration of the transition and/or keyframe (note that a value
* of 1 is 1000ms). If a value of 0 is provided then the animation will be skipped entirely.
*/
duration?: number;
/**
* A number value representing the total delay of the transition and/or keyframe (note that a value of
* 1 is 1000ms). If a value of true is used then whatever delay value is detected from the CSS classes will be
* mirrored on the elements styles (e.g. by setting delay true then the style value of the element will be
* transition-delay: DETECTED_VALUE). Using true is useful when you want the CSS classes and inline styles to
* all share the same CSS delay value.
*/
delay?: number;
/**
* A numeric time value representing the delay between successively animated elements (Click here to
* learn how CSS-based staggering works in ngAnimate.)
*/
stagger?: number;
/**
* The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item
* in the stagger; therefore when a stagger option value of 0.1 is used then there will be a stagger delay of 600ms)
* applyClassesEarly - Whether or not the classes being added or removed will be used when detecting the animation.
* This is set by $animate when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time.
* (Note that this will prevent any transitions from occuring on the classes being added and removed.)
*/
staggerIndex?: number;
}
interface IAnimateCssRunner {
/**
* Starts the animation
*
* @returns The animation runner with a done function for supplying a callback.
*/
start(): IAnimateCssRunnerStart;
/**
* Ends (aborts) the animation
*/
end(): void;
}
interface IAnimateCssRunnerStart extends IPromise<void> {
/**
* Allows you to add done callbacks to the running animation
*
* @param callbackFn: the callback function to be run
*/
done(callbackFn: (animationFinished: boolean) => void): void;
}
/**
* AnimateCssService
* see http://docs.angularjs.org/api/ngAnimate/service/$animateCss
*/
interface IAnimateCssService {
(element: JQuery, animateCssOptions: IAnimationOptions): IAnimateCssRunner;
}
}
declare module angular {
interface IModule {
animation(name: string, animationFactory: angular.animate.IAnimateFactory): IModule;
animation(name: string, inlineAnnotatedFunction: any[]): IModule;
animation(object: Object): IModule;
}
}

View File

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/f0b2681b481397d0c03557ac2ac4d70c1c61c464/angularjs/angular-animate.d.ts",
"raw": "registry:dt/angular-animate#1.5.0+20160407085121",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/f0b2681b481397d0c03557ac2ac4d70c1c61c464/angularjs/angular-animate.d.ts"
}
}

View File

@ -1,339 +0,0 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5b7257019ae959533341a715b339d2562bbf9b85/angularjs/angular-mocks.d.ts
declare module "angular-mocks/ngMock" {
var _: string;
export = _;
}
declare module "angular-mocks/ngMockE2E" {
var _: string;
export = _;
}
declare module "angular-mocks/ngAnimateMock" {
var _: string;
export = _;
}
///////////////////////////////////////////////////////////////////////////////
// ngMock module (angular-mocks.js)
///////////////////////////////////////////////////////////////////////////////
declare namespace angular {
///////////////////////////////////////////////////////////////////////////
// AngularStatic
// We reopen it to add the MockStatic definition
///////////////////////////////////////////////////////////////////////////
interface IAngularStatic {
mock: IMockStatic;
}
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.inject
interface IInjectStatic {
(...fns: Function[]): any;
(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works
strictDi(val?: boolean): void;
}
interface IMockStatic {
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.dump
dump(obj: any): string;
inject: IInjectStatic
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.module
module: {
(...modules: any[]): any;
sharedInjector(): void;
}
// see https://docs.angularjs.org/api/ngMock/type/angular.mock.TzDate
TzDate(offset: number, timestamp: number): Date;
TzDate(offset: number, timestamp: string): Date;
}
///////////////////////////////////////////////////////////////////////////
// ExceptionHandlerService
// see https://docs.angularjs.org/api/ngMock/service/$exceptionHandler
// see https://docs.angularjs.org/api/ngMock/provider/$exceptionHandlerProvider
///////////////////////////////////////////////////////////////////////////
interface IExceptionHandlerProvider extends IServiceProvider {
mode(mode: string): void;
}
///////////////////////////////////////////////////////////////////////////
// TimeoutService
// see https://docs.angularjs.org/api/ngMock/service/$timeout
// Augments the original service
///////////////////////////////////////////////////////////////////////////
interface ITimeoutService {
flush(delay?: number): void;
flushNext(expectedDelay?: number): void;
verifyNoPendingTasks(): void;
}
///////////////////////////////////////////////////////////////////////////
// IntervalService
// see https://docs.angularjs.org/api/ngMock/service/$interval
// Augments the original service
///////////////////////////////////////////////////////////////////////////
interface IIntervalService {
flush(millis?: number): number;
}
///////////////////////////////////////////////////////////////////////////
// LogService
// see https://docs.angularjs.org/api/ngMock/service/$log
// Augments the original service
///////////////////////////////////////////////////////////////////////////
interface ILogService {
assertEmpty(): void;
reset(): void;
}
interface ILogCall {
logs: string[];
}
///////////////////////////////////////////////////////////////////////////
// ControllerService mock
// see https://docs.angularjs.org/api/ngMock/service/$controller
// This interface extends http://docs.angularjs.org/api/ng.$controller
///////////////////////////////////////////////////////////////////////////
interface IControllerService {
// Although the documentation doesn't state this, locals are optional
<T>(controllerConstructor: new (...args: any[]) => T, locals?: any, bindings?: any): T;
<T>(controllerConstructor: Function, locals?: any, bindings?: any): T;
<T>(controllerName: string, locals?: any, bindings?: any): T;
}
///////////////////////////////////////////////////////////////////////////
// ComponentControllerService
// see https://docs.angularjs.org/api/ngMock/service/$componentController
///////////////////////////////////////////////////////////////////////////
interface IComponentControllerService {
// TBinding is an interface exposed by a component as per John Papa's style guide
// https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#accessible-members-up-top
<T, TBinding>(componentName: string, locals: { $scope: IScope, [key: string]: any }, bindings?: TBinding, ident?: string): T;
}
///////////////////////////////////////////////////////////////////////////
// HttpBackendService
// see https://docs.angularjs.org/api/ngMock/service/$httpBackend
///////////////////////////////////////////////////////////////////////////
interface IHttpBackendService {
/**
* Flushes all pending requests using the trained responses.
* @param count Number of responses to flush (in the order they arrived). If undefined, all pending requests will be flushed.
*/
flush(count?: number): void;
/**
* Resets all request expectations, but preserves all backend definitions.
*/
resetExpectations(): void;
/**
* Verifies that all of the requests defined via the expect api were made. If any of the requests were not made, verifyNoOutstandingExpectation throws an exception.
*/
verifyNoOutstandingExpectation(): void;
/**
* Verifies that there are no outstanding requests that need to be flushed.
*/
verifyNoOutstandingRequest(): void;
/**
* Creates a new request expectation.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param method HTTP method.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)) :mock.IRequestHandler;
/**
* Creates a new request expectation for DELETE requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected.
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
*/
expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
/**
* Creates a new request expectation for GET requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
*/
expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
/**
* Creates a new request expectation for HEAD requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
*/
expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object): mock.IRequestHandler;
/**
* Creates a new request expectation for JSONP requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
*/
expectJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler;
/**
* Creates a new request expectation for PATCH requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
/**
* Creates a new request expectation for POST requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
/**
* Creates a new request expectation for PUT requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object): mock.IRequestHandler;
/**
* Creates a new backend definition.
* Returns an object with respond method that controls how a matched request is handled.
* @param method HTTP method.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
/**
* Creates a new backend definition for DELETE requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
/**
* Creates a new backend definition for GET requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
/**
* Creates a new backend definition for HEAD requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
/**
* Creates a new backend definition for JSONP requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
whenJSONP(url: string | RegExp | ((url: string) => boolean)): mock.IRequestHandler;
/**
* Creates a new backend definition for PATCH requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
/**
* Creates a new backend definition for POST requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
/**
* Creates a new backend definition for PUT requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
*/
whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean)): mock.IRequestHandler;
}
export module mock {
// returned interface by the the mocked HttpBackendService expect/when methods
interface IRequestHandler {
/**
* Controls the response for a matched request using a function to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param func Function that receives the request HTTP method, url, data, and headers and returns an array containing response status (number), data, headers, and status text.
*/
respond(func: ((method: string, url: string, data: string | Object, headers: Object) => [number, string | Object, Object, string])): IRequestHandler;
/**
* Controls the response for a matched request using supplied static data to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param status HTTP status code to add to the response.
* @param data Data to add to the response.
* @param headers Headers object to add to the response.
* @param responseText Response text to add to the response.
*/
respond(status: number, data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
/**
* Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param data Data to add to the response.
* @param headers Headers object to add to the response.
* @param responseText Response text to add to the response.
*/
respond(data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
// Available when ngMockE2E is loaded
/**
* Any request matching a backend definition or expectation with passThrough handler will be passed through to the real backend (an XHR request will be made to the server.)
*/
passThrough(): IRequestHandler;
}
}
}
///////////////////////////////////////////////////////////////////////////////
// functions attached to global object (window)
///////////////////////////////////////////////////////////////////////////////
//Use `angular.mock.module` instead of `module`, as `module` conflicts with commonjs.
//declare var module: (...modules: any[]) => any;
declare var inject: angular.IInjectStatic;

View File

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5b7257019ae959533341a715b339d2562bbf9b85/angularjs/angular-mocks.d.ts",
"raw": "registry:dt/angular-mocks#1.3.0+20160425155016",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5b7257019ae959533341a715b339d2562bbf9b85/angularjs/angular-mocks.d.ts"
}
}

View File

@ -1,191 +0,0 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/e684481e0cd360db62fd6213ca7248245315e8a2/angularjs/angular-resource.d.ts
declare module 'angular-resource' {
var _: string;
export = _;
}
///////////////////////////////////////////////////////////////////////////////
// ngResource module (angular-resource.js)
///////////////////////////////////////////////////////////////////////////////
declare namespace angular.resource {
/**
* Currently supported options for the $resource factory options argument.
*/
interface IResourceOptions {
/**
* If true then the trailing slashes from any calculated URL will be stripped (defaults to true)
*/
stripTrailingSlashes?: boolean;
/**
* If true, the request made by a "non-instance" call will be cancelled (if not already completed) by calling
* $cancelRequest() on the call's return value. This can be overwritten per action. (Defaults to false.)
*/
cancellable?: boolean;
}
///////////////////////////////////////////////////////////////////////////
// ResourceService
// see http://docs.angularjs.org/api/ngResource.$resource
// Most part of the following definitions were achieved by analyzing the
// actual implementation, since the documentation doesn't seem to cover
// that deeply.
///////////////////////////////////////////////////////////////////////////
interface IResourceService {
(url: string, paramDefaults?: any,
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
where deleteDescriptor : IActionDescriptor */
actions?: any, options?: IResourceOptions): IResourceClass<IResource<any>>;
<T, U>(url: string, paramDefaults?: any,
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
where deleteDescriptor : IActionDescriptor */
actions?: any, options?: IResourceOptions): U;
<T>(url: string, paramDefaults?: any,
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
where deleteDescriptor : IActionDescriptor */
actions?: any, options?: IResourceOptions): IResourceClass<T>;
}
// Just a reference to facilitate describing new actions
interface IActionDescriptor {
method: string;
params?: any;
url?: string;
isArray?: boolean;
transformRequest?: angular.IHttpRequestTransformer | angular.IHttpRequestTransformer[];
transformResponse?: angular.IHttpResponseTransformer | angular.IHttpResponseTransformer[];
headers?: any;
cache?: boolean | angular.ICacheObject;
/**
* Note: In contrast to $http.config, promises are not supported in $resource, because the same value
* would be used for multiple requests. If you are looking for a way to cancel requests, you should
* use the cancellable option.
*/
timeout?: number
cancellable?: boolean;
withCredentials?: boolean;
responseType?: string;
interceptor?: IHttpInterceptor;
}
// Allow specify more resource methods
// No need to add duplicates for all four overloads.
interface IResourceMethod<T> {
(): T;
(params: Object): T;
(success: Function, error?: Function): T;
(params: Object, success: Function, error?: Function): T;
(params: Object, data: Object, success?: Function, error?: Function): T;
}
// Allow specify resource moethod which returns the array
// No need to add duplicates for all four overloads.
interface IResourceArrayMethod<T> {
(): IResourceArray<T>;
(params: Object): IResourceArray<T>;
(success: Function, error?: Function): IResourceArray<T>;
(params: Object, success: Function, error?: Function): IResourceArray<T>;
(params: Object, data: Object, success?: Function, error?: Function): IResourceArray<T>;
}
// Baseclass for everyresource with default actions.
// If you define your new actions for the resource, you will need
// to extend this interface and typecast the ResourceClass to it.
//
// In case of passing the first argument as anything but a function,
// it's gonna be considered data if the action method is POST, PUT or
// PATCH (in other words, methods with body). Otherwise, it's going
// to be considered as parameters to the request.
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L461-L465
//
// Only those methods with an HTTP body do have 'data' as first parameter:
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L463
// More specifically, those methods are POST, PUT and PATCH:
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L432
//
// Also, static calls always return the IResource (or IResourceArray) retrieved
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L549
interface IResourceClass<T> {
new(dataOrParams? : any) : T;
get: IResourceMethod<T>;
query: IResourceArrayMethod<T>;
save: IResourceMethod<T>;
remove: IResourceMethod<T>;
delete: IResourceMethod<T>;
}
// Instance calls always return the the promise of the request which retrieved the object
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L546
interface IResource<T> {
$get(): angular.IPromise<T>;
$get(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
$get(success: Function, error?: Function): angular.IPromise<T>;
$query(): angular.IPromise<IResourceArray<T>>;
$query(params?: Object, success?: Function, error?: Function): angular.IPromise<IResourceArray<T>>;
$query(success: Function, error?: Function): angular.IPromise<IResourceArray<T>>;
$save(): angular.IPromise<T>;
$save(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
$save(success: Function, error?: Function): angular.IPromise<T>;
$remove(): angular.IPromise<T>;
$remove(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
$remove(success: Function, error?: Function): angular.IPromise<T>;
$delete(): angular.IPromise<T>;
$delete(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
$delete(success: Function, error?: Function): angular.IPromise<T>;
$cancelRequest(): void;
/** the promise of the original server interaction that created this instance. **/
$promise : angular.IPromise<T>;
$resolved : boolean;
toJSON(): T;
}
/**
* Really just a regular Array object with $promise and $resolve attached to it
*/
interface IResourceArray<T> extends Array<T & IResource<T>> {
/** the promise of the original server interaction that created this collection. **/
$promise : angular.IPromise<IResourceArray<T>>;
$resolved : boolean;
}
/** when creating a resource factory via IModule.factory */
interface IResourceServiceFactoryFunction<T> {
($resource: angular.resource.IResourceService): IResourceClass<T>;
<U extends IResourceClass<T>>($resource: angular.resource.IResourceService): U;
}
// IResourceServiceProvider used to configure global settings
interface IResourceServiceProvider extends angular.IServiceProvider {
defaults: IResourceOptions;
}
}
/** extensions to base ng based on using angular-resource */
declare namespace angular {
interface IModule {
/** creating a resource service factory */
factory(name: string, resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction<any>): IModule;
}
}
interface Array<T>
{
/** the promise of the original server interaction that created this collection. **/
$promise : angular.IPromise<Array<T>>;
$resolved : boolean;
}

View File

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/e684481e0cd360db62fd6213ca7248245315e8a2/angularjs/angular-resource.d.ts",
"raw": "registry:dt/angular-resource#1.5.0+20160412142209",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/e684481e0cd360db62fd6213ca7248245315e8a2/angularjs/angular-resource.d.ts"
}
}

View File

@ -1,154 +0,0 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/angularjs/angular-route.d.ts
declare module "angular-route" {
var _: string;
export = _;
}
///////////////////////////////////////////////////////////////////////////////
// ngRoute module (angular-route.js)
///////////////////////////////////////////////////////////////////////////////
declare namespace angular.route {
///////////////////////////////////////////////////////////////////////////
// RouteParamsService
// see http://docs.angularjs.org/api/ngRoute.$routeParams
///////////////////////////////////////////////////////////////////////////
interface IRouteParamsService {
[key: string]: any;
}
///////////////////////////////////////////////////////////////////////////
// RouteService
// see http://docs.angularjs.org/api/ngRoute.$route
// see http://docs.angularjs.org/api/ngRoute.$routeProvider
///////////////////////////////////////////////////////////////////////////
interface IRouteService {
reload(): void;
routes: any;
// May not always be available. For instance, current will not be available
// to a controller that was not initialized as a result of a route maching.
current?: ICurrentRoute;
/**
* Causes $route service to update the current URL, replacing current route parameters with those specified in newParams.
* Provided property names that match the route's path segment definitions will be interpolated into the
* location's path, while remaining properties will be treated as query params.
*
* @param newParams Object.<string, string> mapping of URL parameter names to values
*/
updateParams(newParams:{[key:string]:string}): void;
}
type InlineAnnotatedFunction = Function|Array<string|Function>
/**
* see http://docs.angularjs.org/api/ngRoute/provider/$routeProvider#when for API documentation
*/
interface IRoute {
/**
* {(string|function()=}
* Controller fn that should be associated with newly created scope or the name of a registered controller if passed as a string.
*/
controller?: string|InlineAnnotatedFunction;
/**
* A controller alias name. If present the controller will be published to scope under the controllerAs name.
*/
controllerAs?: string;
/**
* Undocumented?
*/
name?: string;
/**
* {string=|function()=}
* Html template as a string or a function that returns an html template as a string which should be used by ngView or ngInclude directives. This property takes precedence over templateUrl.
*
* If template is a function, it will be called with the following parameters:
*
* {Array.<Object>} - route parameters extracted from the current $location.path() by applying the current route
*/
template?: string|{($routeParams?: angular.route.IRouteParamsService) : string;}
/**
* {string=|function()=}
* Path or function that returns a path to an html template that should be used by ngView.
*
* If templateUrl is a function, it will be called with the following parameters:
*
* {Array.<Object>} - route parameters extracted from the current $location.path() by applying the current route
*/
templateUrl?: string|{ ($routeParams?: angular.route.IRouteParamsService): string; }
/**
* {Object.<string, function>=} - An optional map of dependencies which should be injected into the controller. If any of these dependencies are promises, the router will wait for them all to be resolved or one to be rejected before the controller is instantiated. If all the promises are resolved successfully, the values of the resolved promises are injected and $routeChangeSuccess event is fired. If any of the promises are rejected the $routeChangeError event is fired. The map object is:
*
* - key - {string}: a name of a dependency to be injected into the controller.
* - factory - {string|function}: If string then it is an alias for a service. Otherwise if function, then it is injected and the return value is treated as the dependency. If the result is a promise, it is resolved before its value is injected into the controller. Be aware that ngRoute.$routeParams will still refer to the previous route within these resolve functions. Use $route.current.params to access the new route parameters, instead.
*/
resolve?: {[key: string]: any};
/**
* {(string|function())=}
* Value to update $location path with and trigger route redirection.
*
* If redirectTo is a function, it will be called with the following parameters:
*
* - {Object.<string>} - route parameters extracted from the current $location.path() by applying the current route templateUrl.
* - {string} - current $location.path()
* - {Object} - current $location.search()
* - The custom redirectTo function is expected to return a string which will be used to update $location.path() and $location.search().
*/
redirectTo?: string|{($routeParams?: angular.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any) : string};
/**
* Reload route when only $location.search() or $location.hash() changes.
*
* This option defaults to true. If the option is set to false and url in the browser changes, then $routeUpdate event is broadcasted on the root scope.
*/
reloadOnSearch?: boolean;
/**
* Match routes without being case sensitive
*
* This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive
*/
caseInsensitiveMatch?: boolean;
}
// see http://docs.angularjs.org/api/ng.$route#current
interface ICurrentRoute extends IRoute {
locals: {
[index: string]: any;
$scope: IScope;
$template: string;
};
params: any;
}
interface IRouteProvider extends IServiceProvider {
/**
* Match routes without being case sensitive
*
* This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive
*/
caseInsensitiveMatch?: boolean;
/**
* Sets route definition that will be used on route change when no other route definition is matched.
*
* @params Mapping information to be assigned to $route.current.
*/
otherwise(params: IRoute): IRouteProvider;
/**
* Adds a new route definition to the $route service.
*
* @param path Route path (matched against $location.path). If $location.path contains redundant trailing slash or is missing one, the route will still match and the $location.path will be updated to add or drop the trailing slash to exactly match the route definition.
*
* - path can contain named groups starting with a colon: e.g. :name. All characters up to the next slash are matched and stored in $routeParams under the given name when the route matches.
* - path can contain named groups starting with a colon and ending with a star: e.g.:name*. All characters are eagerly stored in $routeParams under the given name when the route matches.
* - path can contain optional named groups with a question mark: e.g.:name?.
*
* For example, routes like /color/:color/largecode/:largecode*\/edit will match /color/brown/largecode/code/with/slashes/edit and extract: color: brown and largecode: code/with/slashes.
*
* @param route Mapping information to be assigned to $route.current on route match.
*/
when(path: string, route: IRoute): IRouteProvider;
}
}

View File

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/angularjs/angular-route.d.ts",
"raw": "registry:dt/angular-route#1.3.0+20160317120654",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/angularjs/angular-route.d.ts"
}
}

View File

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b76dd8a7f95b71696982befbb7589940d27e940b/angularjs/angular.d.ts",
"raw": "registry:dt/angular#1.5.0+20160517064839",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b76dd8a7f95b71696982befbb7589940d27e940b/angularjs/angular.d.ts"
}
}

View File

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/4cdfbe96b666eec5e1defbb519a62abf04e96764/jquery/jquery.d.ts",
"raw": "registry:dt/jquery#1.10.0+20160417213236",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/4cdfbe96b666eec5e1defbb519a62abf04e96764/jquery/jquery.d.ts"
}
}

View File

@ -1,6 +0,0 @@
/// <reference path="globals/angular-animate/index.d.ts" />
/// <reference path="globals/angular-mocks/index.d.ts" />
/// <reference path="globals/angular-resource/index.d.ts" />
/// <reference path="globals/angular-route/index.d.ts" />
/// <reference path="globals/angular/index.d.ts" />
/// <reference path="globals/jquery/index.d.ts" />

View File

@ -1,5 +1,6 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
// Angular E2E Testing Guide:
// https://docs.angularjs.org/guide/e2e-testing
@ -10,7 +11,7 @@ describe('PhoneCat Application', function() {
it('should redirect `index.html` to `index.html#!/phones', function() {
browser.get('index.html');
browser.waitForAngular();
browser.getCurrentUrl().then(function(url) {
browser.getCurrentUrl().then(function(url: string) {
expect(url.endsWith('/phones')).toBe(true);
});
});
@ -28,11 +29,11 @@ describe('PhoneCat Application', function() {
expect(phoneList.count()).toBe(20);
sendKeys(query, 'nexus');
query.sendKeys('nexus');
expect(phoneList.count()).toBe(1);
query.clear();
sendKeys(query, 'motorola');
query.sendKeys('motorola');
expect(phoneList.count()).toBe(8);
});
@ -48,7 +49,7 @@ describe('PhoneCat Application', function() {
});
}
sendKeys(queryField, 'tablet'); // Let's narrow the dataset to make the assertions shorter
queryField.sendKeys('tablet'); // Let's narrow the dataset to make the assertions shorter
expect(getNames()).toEqual([
'Motorola XOOM\u2122 with Wi-Fi',
@ -72,7 +73,7 @@ describe('PhoneCat Application', function() {
query.sendKeys(str.charAt(i));
}
element.all(by.css('.phones li a')).first().click();
browser.getCurrentUrl().then(function(url) {
browser.getCurrentUrl().then(function(url: string) {
expect(url.endsWith('/phones/nexus-s')).toBe(true);
});
});

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by, protractor } from 'protractor';
describe('User Input Tests', function () {
beforeAll(function () {
@ -29,9 +31,8 @@ describe('User Input Tests', function () {
let inputEle = mainEle.element(by.css('input'));
let outputTextEle = mainEle.element(by.css('p'));
expect(outputTextEle.getText()).toEqual('');
return sendKeys(inputEle, 'abc').then(function() {
expect(outputTextEle.getText()).toEqual('a | ab | abc |');
});
inputEle.sendKeys('abc');
expect(outputTextEle.getText()).toEqual('a | ab | abc |');
});
it('should support user input from a local template let (loopback)', function () {
@ -39,9 +40,8 @@ describe('User Input Tests', function () {
let inputEle = mainEle.element(by.css('input'));
let outputTextEle = mainEle.element(by.css('p'));
expect(outputTextEle.getText()).toEqual('');
return sendKeys(inputEle, 'abc').then(function() {
expect(outputTextEle.getText()).toEqual('abc');
});
inputEle.sendKeys('abc');
expect(outputTextEle.getText()).toEqual('abc');
});
it('should be able to combine click event with a local template var', function () {
@ -49,19 +49,19 @@ describe('User Input Tests', function () {
let inputEle = mainEle.element(by.css('input'));
let outputTextEle = mainEle.element(by.css('p'));
expect(outputTextEle.getText()).toEqual('');
return sendKeys(inputEle, 'abc').then(function() {
expect(outputTextEle.getText()).toEqual('a | ab | abc |');
});
inputEle.sendKeys('abc');
expect(outputTextEle.getText()).toEqual('a | ab | abc |');
});
it('should be able to filter key events', async () => {
xit('should be able to filter key events', () => {
let mainEle = element(by.css('key-up3'));
let inputEle = mainEle.element(by.css('input'));
let outputTextEle = mainEle.element(by.css('p'));
expect(outputTextEle.getText()).toEqual('');
await sendKeys(inputEle, 'abc');
inputEle.sendKeys('abc');
expect(outputTextEle.getText()).toEqual('', 'should be blank - have not sent enter yet');
await sendKeys(inputEle, protractor.Key.ENTER);
// broken atm, see https://github.com/angular/angular/issues/9419
inputEle.sendKeys(protractor.Key.ENTER);
expect(outputTextEle.getText()).toEqual('abc');
});
@ -71,11 +71,10 @@ describe('User Input Tests', function () {
let inputEle = mainEle.element(by.css('input'));
let outputTextEle = mainEle.element(by.css('p'));
expect(outputTextEle.getText()).toEqual('');
return sendKeys(inputEle, 'abc').then(function() {
expect(outputTextEle.getText()).toEqual('', 'should be blank - have not sent enter yet');
// change the focus
return prevInputEle.click();
}).then(function() {
inputEle.sendKeys('abc');
expect(outputTextEle.getText()).toEqual('', 'should be blank - have not sent enter yet');
// change the focus
prevInputEle.click().then(function() {
expect(outputTextEle.getText()).toEqual('abc');
});
});
@ -87,10 +86,9 @@ describe('User Input Tests', function () {
let heroEles = mainEle.all(by.css('li'));
let numHeroes: number;
expect(heroEles.count()).toBeGreaterThan(0);
heroEles.count().then(function(count) {
heroEles.count().then(function(count: number) {
numHeroes = count;
return sendKeys(inputEle, 'abc');
}).then(function() {
inputEle.sendKeys('abc');
return addButtonEle.click();
}).then(function() {
expect(heroEles.count()).toEqual(numHeroes + 1, 'should be one more hero added');

View File

@ -1,5 +1,7 @@
/// <reference path='../_protractor/e2e.d.ts' />
'use strict';
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';
describe('QuickStart E2E Tests', function () {
let expectedMsg = 'Hello from Angular App with Webpack';

View File

@ -3,6 +3,5 @@
set -ex -o pipefail
(cd public/docs/_examples && npm install --no-optional)
(cd public/docs/_examples/_protractor && npm install --no-optional)
npm run webdriver:update --prefix public/docs/_examples/_protractor
npm run webdriver:update --prefix public/docs/_examples
gulp add-example-boilerplate

View File

@ -209,10 +209,10 @@ class PlunkerBuilder {
_getPlunkerFiles() {
// Assume plunker version is sibling of node_modules version
this.readme = fs.readFileSync(this.basePath + '/plunker.README.md', 'utf-8');
var systemJsConfigPath = '/systemjs.config.plunker.js';
this.readme = fs.readFileSync(this.basePath + '/_boilerplate/plunker.README.md', 'utf-8');
var systemJsConfigPath = '/_boilerplate/systemjs.config.plunker.js';
if (this.options.build) {
systemJsConfigPath = '/systemjs.config.plunker.build.js';
systemJsConfigPath = '/_boilerplate/systemjs.config.plunker.build.js';
}
this.systemjsConfig = fs.readFileSync(this.basePath + systemJsConfigPath, 'utf-8');
this.systemjsConfig += this.copyrights.jsCss;