diff --git a/modules/@angular/examples/router_deprecated/ts/.gitkeep b/modules/@angular/examples/router_deprecated/ts/.gitkeep
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/modules/@angular/examples/router_deprecated/ts/can_activate/can_activate_example.ts b/modules/@angular/examples/router_deprecated/ts/can_activate/can_activate_example.ts
deleted file mode 100644
index 33bcd4739b..0000000000
--- a/modules/@angular/examples/router_deprecated/ts/can_activate/can_activate_example.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {APP_BASE_HREF} from '@angular/common';
-import {Component, ComponentRef} from '@angular/core';
-import {bootstrap} from '@angular/platform-browser-dynamic';
-import {CanActivate, ComponentInstruction, ROUTER_DIRECTIVES, RouteConfig} from '@angular/router-deprecated';
-
-function checkIfWeHavePermission(instruction: ComponentInstruction) {
- return instruction.params['id'] == '1';
-}
-
-// #docregion canActivate
-@Component({selector: 'control-panel-cmp', template: `
Settings: ...
`})
-@CanActivate(checkIfWeHavePermission)
-class ControlPanelCmp {
-}
-// #enddocregion
-
-
-@Component({
- selector: 'home-cmp',
- template: `
- Welcome Home!
-
- `,
- directives: [ROUTER_DIRECTIVES]
-})
-class HomeCmp {
-}
-
-
-@Component({
- selector: 'example-app',
- template: `
- My App
-
- `,
- directives: [ROUTER_DIRECTIVES]
-})
-@RouteConfig([
- {path: '/user-settings/:id', component: ControlPanelCmp, name: 'ControlPanelCmp'},
- {path: '/', component: HomeCmp, name: 'HomeCmp'}
-])
-export class AppCmp {
-}
-
-
-export function main(): Promise> {
- return bootstrap(
- AppCmp, [{provide: APP_BASE_HREF, useValue: '/@angular/examples/router/ts/can_activate'}]);
-}
diff --git a/modules/@angular/examples/router_deprecated/ts/can_activate/can_activate_spec.ts b/modules/@angular/examples/router_deprecated/ts/can_activate/can_activate_spec.ts
deleted file mode 100644
index dd30a7522f..0000000000
--- a/modules/@angular/examples/router_deprecated/ts/can_activate/can_activate_spec.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {verifyNoBrowserErrors} from 'e2e_util/e2e_util';
-
-function waitForElement(selector: string) {
- var EC = (protractor).ExpectedConditions;
- // Waits for the element with id 'abc' to be present on the dom.
- browser.wait(EC.presenceOf($(selector)), 20000);
-}
-
-describe('reuse example app', function() {
-
- afterEach(verifyNoBrowserErrors);
-
- var URL = '@angular/examples/router/ts/can_activate/';
-
- it('should navigate to user 1', function() {
- browser.get(URL);
- waitForElement('home-cmp');
-
- element(by.css('#user-1-link')).click();
- waitForElement('control-panel-cmp');
- expect(browser.getCurrentUrl()).toMatch(/\/user-settings\/1$/);
-
- expect(element(by.css('control-panel-cmp')).getText()).toContain('Settings');
- });
-
- it('should not navigate to user 2', function() {
- browser.get(URL);
- waitForElement('home-cmp');
-
- element(by.css('#user-2-link')).click();
- waitForElement('home-cmp');
-
- expect(element(by.css('home-cmp')).getText()).toContain('Welcome Home!');
- });
-});
diff --git a/modules/@angular/examples/router_deprecated/ts/can_activate/index.html b/modules/@angular/examples/router_deprecated/ts/can_activate/index.html
deleted file mode 100644
index c50572f0eb..0000000000
--- a/modules/@angular/examples/router_deprecated/ts/can_activate/index.html
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
- Routing canActivate Lifecycle Example
-
-
-
-
-
-
-
-
-
- Loading...
-
-
-
-
diff --git a/modules/@angular/examples/router_deprecated/ts/can_deactivate/can_deactivate_example.ts b/modules/@angular/examples/router_deprecated/ts/can_deactivate/can_deactivate_example.ts
deleted file mode 100644
index b53c2c200c..0000000000
--- a/modules/@angular/examples/router_deprecated/ts/can_deactivate/can_deactivate_example.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {APP_BASE_HREF} from '@angular/common';
-import {Component, ComponentRef, provide} from '@angular/core';
-import {bootstrap} from '@angular/platform-browser-dynamic';
-import {CanDeactivate, ComponentInstruction, ROUTER_DIRECTIVES, RouteConfig, RouteParams} from '@angular/router-deprecated';
-
-
-// #docregion routerCanDeactivate
-@Component({
- selector: 'note-cmp',
- template: `
-
-
id: {{id}}
-
- `
-})
-class NoteCmp implements CanDeactivate {
- id: string;
-
- constructor(params: RouteParams) { this.id = params.get('id'); }
-
- routerCanDeactivate(next: ComponentInstruction, prev: ComponentInstruction) {
- return confirm('Are you sure you want to leave?');
- }
-}
-// #enddocregion
-
-
-@Component({
- selector: 'note-index-cmp',
- template: `
- Your Notes
-
- `,
- directives: [ROUTER_DIRECTIVES]
-})
-class NoteIndexCmp {
-}
-
-
-@Component({
- selector: 'example-app',
- template: `
- My App
-
- `,
- directives: [ROUTER_DIRECTIVES]
-})
-@RouteConfig([
- {path: '/note/:id', component: NoteCmp, name: 'NoteCmp'},
- {path: '/', component: NoteIndexCmp, name: 'NoteIndexCmp'}
-])
-export class AppCmp {
-}
-
-
-export function main(): Promise> {
- return bootstrap(
- AppCmp, [{provide: APP_BASE_HREF, useValue: '/@angular/examples/router/ts/can_deactivate'}]);
-}
diff --git a/modules/@angular/examples/router_deprecated/ts/can_deactivate/can_deactivate_spec.ts b/modules/@angular/examples/router_deprecated/ts/can_deactivate/can_deactivate_spec.ts
deleted file mode 100644
index 35f6bf6ec8..0000000000
--- a/modules/@angular/examples/router_deprecated/ts/can_deactivate/can_deactivate_spec.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {verifyNoBrowserErrors} from 'e2e_util/e2e_util';
-
-function waitForElement(selector: string) {
- var EC = (protractor).ExpectedConditions;
- // Waits for the element with id 'abc' to be present on the dom.
- browser.wait(EC.presenceOf($(selector)), 20000);
-}
-
-function waitForAlert() {
- var EC = (protractor).ExpectedConditions;
- browser.wait(EC.alertIsPresent(), 1000);
-}
-
-describe('can deactivate example app', function() {
-
- afterEach(verifyNoBrowserErrors);
-
- var URL = '@angular/examples/router/ts/can_deactivate/';
-
- it('should not navigate away when prompt is cancelled', function() {
- browser.get(URL);
- waitForElement('note-index-cmp');
-
- element(by.css('#note-1-link')).click();
- waitForElement('note-cmp');
-
- browser.navigate().back();
- waitForAlert();
-
- browser.switchTo().alert().dismiss(); // Use to simulate cancel button
-
- expect(element(by.css('note-cmp')).getText()).toContain('id: 1');
- });
-
- it('should navigate away when prompt is confirmed', function() {
- browser.get(URL);
- waitForElement('note-index-cmp');
-
- element(by.css('#note-1-link')).click();
- waitForElement('note-cmp');
-
- browser.navigate().back();
- waitForAlert();
-
- browser.switchTo().alert().accept();
-
- waitForElement('note-index-cmp');
-
- expect(element(by.css('note-index-cmp')).getText()).toContain('Your Notes');
- });
-});
diff --git a/modules/@angular/examples/router_deprecated/ts/can_deactivate/index.html b/modules/@angular/examples/router_deprecated/ts/can_deactivate/index.html
deleted file mode 100644
index 18d7839646..0000000000
--- a/modules/@angular/examples/router_deprecated/ts/can_deactivate/index.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- Routing routerCanDeactivate Lifecycle Example
-
-
-
-
-
-
-
-
-
-
- Loading...
-
-
-
-
diff --git a/modules/@angular/examples/router_deprecated/ts/on_activate/on_activate_example.ts b/modules/@angular/examples/router_deprecated/ts/on_activate/on_activate_example.ts
deleted file mode 100644
index f14c3e7c4a..0000000000
--- a/modules/@angular/examples/router_deprecated/ts/on_activate/on_activate_example.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {APP_BASE_HREF} from '@angular/common';
-import {Component, ComponentRef, provide} from '@angular/core';
-import {bootstrap} from '@angular/platform-browser-dynamic';
-import {ComponentInstruction, OnActivate, ROUTER_DIRECTIVES, RouteConfig} from '@angular/router-deprecated';
-
-
-// #docregion routerOnActivate
-@Component({template: `Child`})
-class ChildCmp {
-}
-
-@Component({
- template: `
- Parent ( )
- {{log}}
`,
- directives: [ROUTER_DIRECTIVES]
-})
-@RouteConfig([{path: '/child', name: 'Child', component: ChildCmp}])
-class ParentCmp implements OnActivate {
- log: string = '';
-
- routerOnActivate(next: ComponentInstruction, prev: ComponentInstruction) {
- this.log = `Finished navigating from "${prev ? prev.urlPath : 'null'}" to "${next.urlPath}"`;
-
- return new Promise(resolve => {
- // The ChildCmp gets instantiated only when the Promise is resolved
- setTimeout(() => resolve(null), 1000);
- });
- }
-}
-// #enddocregion
-
-
-@Component({
- selector: 'example-app',
- template: `
- My app
-
-
- Child
-
-
- `,
- directives: [ROUTER_DIRECTIVES]
-})
-@RouteConfig([{path: '/parent/...', name: 'Parent', component: ParentCmp}])
-export class AppCmp {
-}
-
-export function main(): Promise> {
- return bootstrap(
- AppCmp, [{provide: APP_BASE_HREF, useValue: '/@angular/examples/router/ts/on_activate'}]);
-}
diff --git a/modules/@angular/examples/router_deprecated/ts/on_deactivate/index.html b/modules/@angular/examples/router_deprecated/ts/on_deactivate/index.html
deleted file mode 100644
index 9dcb0bb8ae..0000000000
--- a/modules/@angular/examples/router_deprecated/ts/on_deactivate/index.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- Routing Reuse Lifecycle Example
-
-
-
-
-
-
-
-
-
-
- Loading...
-
-
-
-
diff --git a/modules/@angular/examples/router_deprecated/ts/on_deactivate/on_deactivate_example.ts b/modules/@angular/examples/router_deprecated/ts/on_deactivate/on_deactivate_example.ts
deleted file mode 100644
index 7b36f17df0..0000000000
--- a/modules/@angular/examples/router_deprecated/ts/on_deactivate/on_deactivate_example.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {APP_BASE_HREF} from '@angular/common';
-import {Component, ComponentRef, Injectable} from '@angular/core';
-import {bootstrap} from '@angular/platform-browser-dynamic';
-import {ComponentInstruction, OnDeactivate, ROUTER_DIRECTIVES, RouteConfig} from '@angular/router-deprecated';
-
-
-@Injectable()
-export class LogService {
- logs: string[] = [];
-
- addLog(message: string): void { this.logs.push(message); }
-}
-
-
-// #docregion routerOnDeactivate
-@Component({selector: 'my-cmp', template: `hello
`})
-class MyCmp implements OnDeactivate {
- constructor(private logService: LogService) {}
-
- routerOnDeactivate(next: ComponentInstruction, prev: ComponentInstruction) {
- this.logService.addLog(
- `Navigating from "${prev ? prev.urlPath : 'null'}" to "${next.urlPath}"`);
- }
-}
-// #enddocregion
-
-
-@Component({
- selector: 'example-app',
- template: `
- My App
-
- Navigate Home |
- Navigate with a Param
-
-
-
- `,
- directives: [ROUTER_DIRECTIVES]
-})
-@RouteConfig([
- {path: '/', component: MyCmp, name: 'HomeCmp'},
- {path: '/:param', component: MyCmp, name: 'ParamCmp'}
-])
-export class AppCmp {
- constructor(public logService: LogService) {}
-}
-
-
-export function main(): Promise> {
- return bootstrap(AppCmp, [
- {provide: APP_BASE_HREF, useValue: '/@angular/examples/router/ts/on_deactivate'}, LogService
- ]);
-}
diff --git a/modules/@angular/examples/router_deprecated/ts/on_deactivate/on_deactivate_spec.ts b/modules/@angular/examples/router_deprecated/ts/on_deactivate/on_deactivate_spec.ts
deleted file mode 100644
index d64b26d6ca..0000000000
--- a/modules/@angular/examples/router_deprecated/ts/on_deactivate/on_deactivate_spec.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {verifyNoBrowserErrors} from 'e2e_util/e2e_util';
-
-function waitForElement(selector: string) {
- var EC = (protractor).ExpectedConditions;
- // Waits for the element with id 'abc' to be present on the dom.
- browser.wait(EC.presenceOf($(selector)), 20000);
-}
-
-describe('on activate example app', function() {
- afterEach(verifyNoBrowserErrors);
-
- var URL = '@angular/examples/router/ts/on_deactivate/';
-
- it('should update the text when navigating between routes', function() {
- browser.get(URL);
- waitForElement('my-cmp');
-
- expect(element(by.css('#log')).getText()).toEqual('Log:');
-
- element(by.css('#param-link')).click();
- waitForElement('my-cmp');
-
- expect(element(by.css('#log')).getText()).toEqual('Log:\nNavigating from "" to "1"');
-
- browser.navigate().back();
- waitForElement('my-cmp');
-
- expect(element(by.css('#log')).getText())
- .toEqual('Log:\nNavigating from "" to "1"\nNavigating from "./1" to ""');
- });
-});
diff --git a/modules/@angular/examples/router_deprecated/ts/reuse/index.html b/modules/@angular/examples/router_deprecated/ts/reuse/index.html
deleted file mode 100644
index 14bf784ba2..0000000000
--- a/modules/@angular/examples/router_deprecated/ts/reuse/index.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- Routing Reuse Lifecycle Example
-
-
-
-
-
-
-
-
-
-
- Loading...
-
-
-
-
diff --git a/modules/@angular/examples/router_deprecated/ts/reuse/reuse_example.ts b/modules/@angular/examples/router_deprecated/ts/reuse/reuse_example.ts
deleted file mode 100644
index d5ad3162d6..0000000000
--- a/modules/@angular/examples/router_deprecated/ts/reuse/reuse_example.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {APP_BASE_HREF} from '@angular/common';
-import {Component, ComponentRef} from '@angular/core';
-import {bootstrap} from '@angular/platform-browser-dynamic';
-import {CanReuse, ComponentInstruction, OnReuse, ROUTER_DIRECTIVES, RouteConfig, RouteParams} from '@angular/router-deprecated';
-
-
-
-// #docregion reuseCmp
-@Component({
- selector: 'my-cmp',
- template: `
- hello {{name}}!
- message:
- `
-})
-class MyCmp implements CanReuse,
- OnReuse {
- name: string;
- constructor(params: RouteParams) { this.name = params.get('name') || 'NOBODY'; }
-
- routerCanReuse(next: ComponentInstruction, prev: ComponentInstruction) { return true; }
-
- routerOnReuse(next: ComponentInstruction, prev: ComponentInstruction) {
- this.name = next.params['name'];
- }
-}
-// #enddocregion
-
-
-@Component({
- selector: 'example-app',
- template: `
- Say hi to...
- Naomi |
- Brad
-
- `,
- directives: [ROUTER_DIRECTIVES]
-})
-@RouteConfig([
- {path: '/', component: MyCmp, name: 'HomeCmp'},
- {path: '/:name', component: MyCmp, name: 'HomeCmp'}
-])
-export class AppCmp {
-}
-
-
-export function main(): Promise> {
- return bootstrap(
- AppCmp, [{provide: APP_BASE_HREF, useValue: '/@angular/examples/router/ts/reuse'}]);
-}
diff --git a/modules/@angular/examples/router_deprecated/ts/reuse/reuse_spec.ts b/modules/@angular/examples/router_deprecated/ts/reuse/reuse_spec.ts
deleted file mode 100644
index 942b11a56a..0000000000
--- a/modules/@angular/examples/router_deprecated/ts/reuse/reuse_spec.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {verifyNoBrowserErrors} from 'e2e_util/e2e_util';
-
-function waitForElement(selector: string) {
- var EC = (protractor).ExpectedConditions;
- // Waits for the element with id 'abc' to be present on the dom.
- browser.wait(EC.presenceOf($(selector)), 20000);
-}
-
-describe('reuse example app', function() {
-
- afterEach(verifyNoBrowserErrors);
-
- var URL = '@angular/examples/router/ts/reuse/';
-
- it('should build a link which points to the detail page', function() {
- browser.get(URL);
- waitForElement('my-cmp');
-
- element(by.css('#naomi-link')).click();
- waitForElement('my-cmp');
- expect(browser.getCurrentUrl()).toMatch(/\/naomi$/);
-
- // type something into input
- element(by.css('#message')).sendKeys('long time no see!');
-
- // navigate to Brad
- element(by.css('#brad-link')).click();
- waitForElement('my-cmp');
- expect(browser.getCurrentUrl()).toMatch(/\/brad$/);
-
- // check that typed input is the same
- expect(element(by.css('#message')).getAttribute('value')).toEqual('long time no see!');
- });
-
-});
diff --git a/modules/@angular/router-deprecated/core_private.ts b/modules/@angular/router-deprecated/core_private.ts
deleted file mode 100644
index 9ac49fdbc0..0000000000
--- a/modules/@angular/router-deprecated/core_private.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {__core_private__ as _} from '@angular/core';
-
-export var makeDecorator: typeof _.makeDecorator = _.makeDecorator;
-export var reflector: typeof _.reflector = _.reflector;
diff --git a/modules/@angular/router-deprecated/index.ts b/modules/@angular/router-deprecated/index.ts
deleted file mode 100644
index aada80680a..0000000000
--- a/modules/@angular/router-deprecated/index.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-export * from './router';
diff --git a/modules/@angular/router-deprecated/package.json b/modules/@angular/router-deprecated/package.json
deleted file mode 100644
index 634a4f0bce..0000000000
--- a/modules/@angular/router-deprecated/package.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "name": "@angular/router-deprecated",
- "version": "0.0.0-PLACEHOLDER",
- "description": "",
- "main": "index.js",
- "jsnext:main": "esm/index.js",
- "typins": "index.d.ts",
- "author": "angular",
- "license": "MIT",
- "peerDependencies": {
- "@angular/core": "0.0.0-PLACEHOLDER",
- "@angular/common": "0.0.0-PLACEHOLDER",
- "@angular/platform-browser": "0.0.0-PLACEHOLDER"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/angular/angular.git"
- }
-}
diff --git a/modules/@angular/router-deprecated/rollup.config.js b/modules/@angular/router-deprecated/rollup.config.js
deleted file mode 100644
index fc905e7587..0000000000
--- a/modules/@angular/router-deprecated/rollup.config.js
+++ /dev/null
@@ -1,19 +0,0 @@
-
-export default {
- entry: '../../../dist/packages-dist/router-deprecated/esm/index.js',
- dest: '../../../dist/packages-dist/router-deprecated/esm/router-deprecated.umd.js',
- format: 'umd',
- moduleName: 'ng.router_deprecated',
- globals: {
- '@angular/core': 'ng.core',
- '@angular/common': 'ng.common',
- '@angular/platform-browser': 'ng.platformBrowser',
- 'rxjs/Subject': 'Rx',
- 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update.
- 'rxjs/operator/toPromise': 'Rx.Observable.prototype',
- 'rxjs/Observable': 'Rx'
- },
- plugins: [
-// nodeResolve({ jsnext: true, main: true }),
- ]
-}
diff --git a/modules/@angular/router-deprecated/router.ts b/modules/@angular/router-deprecated/router.ts
deleted file mode 100644
index 0bbaba30de..0000000000
--- a/modules/@angular/router-deprecated/router.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-/**
- * @module
- * @description
- * Maps application URLs into application states, to support deep-linking and navigation.
- */
-
-export {RouterLink} from './src/directives/router_link';
-export {RouterOutlet} from './src/directives/router_outlet';
-export {RouteData, RouteParams} from './src/instruction';
-export {ROUTER_PRIMARY_COMPONENT, RouteRegistry} from './src/route_registry';
-export {RootRouter, Router} from './src/router';
-
-export * from './src/route_config/route_config_decorator';
-export * from './src/route_definition';
-export {OnActivate, OnDeactivate, OnReuse, CanDeactivate, CanReuse} from './src/interfaces';
-export {CanActivate} from './src/lifecycle/lifecycle_annotations';
-export {Instruction, ComponentInstruction} from './src/instruction';
-export {OpaqueToken} from '@angular/core';
-export {ROUTER_PROVIDERS_COMMON} from './src/router_providers_common';
-export {ROUTER_PROVIDERS, ROUTER_BINDINGS} from './src/router_providers';
-
-import {RouterOutlet} from './src/directives/router_outlet';
-import {RouterLink} from './src/directives/router_link';
-
-/**
- * A list of directives. To use the router directives like {@link RouterOutlet} and
- * {@link RouterLink}, add this to your `directives` array in the {@link Component} decorator
- * of your component.
- *
- * ### Example ([live demo](http://plnkr.co/edit/iRUP8B5OUbxCWQ3AcIDm))
- *
- * ```
- * import {Component} from '@angular/core';
- * import {ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig} from '@angular/router-deprecated';
- *
- * @Component({directives: [ROUTER_DIRECTIVES]})
- * @RouteConfig([
- * {...},
- * ])
- * class AppCmp {
- * // ...
- * }
- *
- * bootstrap(AppCmp, [ROUTER_PROVIDERS]);
- * ```
- */
-export const ROUTER_DIRECTIVES: any[] = [RouterOutlet, RouterLink];
diff --git a/modules/@angular/router-deprecated/src/directives/router_link.ts b/modules/@angular/router-deprecated/src/directives/router_link.ts
deleted file mode 100644
index 59142eeb12..0000000000
--- a/modules/@angular/router-deprecated/src/directives/router_link.ts
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Location} from '@angular/common';
-import {Directive} from '@angular/core';
-
-import {isString} from '../facade/lang';
-import {Instruction} from '../instruction';
-import {Router} from '../router';
-
-
-/**
- * The RouterLink directive lets you link to specific parts of your app.
- *
- * Consider the following route configuration:
-
- * ```
- * @RouteConfig([
- * { path: '/user', component: UserCmp, name: 'User' }
- * ]);
- * class MyComp {}
- * ```
- *
- * When linking to this `User` route, you can write:
- *
- * ```
- * link to user component
- * ```
- *
- * RouterLink expects the value to be an array of route names, followed by the params
- * for that level of routing. For instance `['/Team', {teamId: 1}, 'User', {userId: 2}]`
- * means that we want to generate a link for the `Team` route with params `{teamId: 1}`,
- * and with a child route `User` with params `{userId: 2}`.
- *
- * The first route name should be prepended with `/`, `./`, or `../`.
- * If the route begins with `/`, the router will look up the route from the root of the app.
- * If the route begins with `./`, the router will instead look in the current component's
- * children for the route. And if the route begins with `../`, the router will look at the
- * current component's parent.
- */
-@Directive({
- selector: '[routerLink]',
- inputs: ['routeParams: routerLink', 'target'],
- host: {
- '(click)': 'onClick()',
- '[attr.href]': 'visibleHref',
- '[class.router-link-active]': 'isRouteActive'
- }
-})
-export class RouterLink {
- private _routeParams: any[];
-
- // the url displayed on the anchor element.
- visibleHref: string;
- target: string;
-
- // the instruction passed to the router to navigate
- private _navigationInstruction: Instruction;
-
- constructor(private _router: Router, private _location: Location) {
- // we need to update the link whenever a route changes to account for aux routes
- this._router.subscribe((_) => this._updateLink());
- }
-
- // because auxiliary links take existing primary and auxiliary routes into account,
- // we need to update the link whenever params or other routes change.
- private _updateLink(): void {
- this._navigationInstruction = this._router.generate(this._routeParams);
- var navigationHref = this._navigationInstruction.toLinkUrl();
- this.visibleHref = this._location.prepareExternalUrl(navigationHref);
- }
-
- get isRouteActive(): boolean { return this._router.isRouteActive(this._navigationInstruction); }
-
- set routeParams(changes: any[]) {
- this._routeParams = changes;
- this._updateLink();
- }
-
- onClick(): boolean {
- // If no target, or if target is _self, prevent default browser behavior
- if (!isString(this.target) || this.target == '_self') {
- this._router.navigateByInstruction(this._navigationInstruction);
- return false;
- }
- return true;
- }
-}
diff --git a/modules/@angular/router-deprecated/src/directives/router_outlet.ts b/modules/@angular/router-deprecated/src/directives/router_outlet.ts
deleted file mode 100644
index e32880873c..0000000000
--- a/modules/@angular/router-deprecated/src/directives/router_outlet.ts
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Attribute, ComponentRef, Directive, DynamicComponentLoader, OnDestroy, Output, ReflectiveInjector, ViewContainerRef, provide} from '@angular/core';
-
-import {EventEmitter} from '../facade/async';
-import {StringMapWrapper} from '../facade/collection';
-import {isBlank, isPresent} from '../facade/lang';
-import {ComponentInstruction, RouteData, RouteParams} from '../instruction';
-import {CanDeactivate, CanReuse, OnActivate, OnDeactivate, OnReuse} from '../interfaces';
-import * as hookMod from '../lifecycle/lifecycle_annotations';
-import {hasLifecycleHook} from '../lifecycle/route_lifecycle_reflector';
-import * as routerMod from '../router';
-
-let _resolveToTrue = Promise.resolve(true);
-
-/**
- * A router outlet is a placeholder that Angular dynamically fills based on the application's route.
- *
- * ## Use
- *
- * ```
- *
- * ```
- */
-@Directive({selector: 'router-outlet'})
-export class RouterOutlet implements OnDestroy {
- name: string = null;
- private _componentRef: Promise> = null;
- private _currentInstruction: ComponentInstruction = null;
-
- @Output('activate') public activateEvents = new EventEmitter();
-
- constructor(
- private _viewContainerRef: ViewContainerRef, private _loader: DynamicComponentLoader,
- private _parentRouter: routerMod.Router, @Attribute('name') nameAttr: string) {
- if (isPresent(nameAttr)) {
- this.name = nameAttr;
- this._parentRouter.registerAuxOutlet(this);
- } else {
- this._parentRouter.registerPrimaryOutlet(this);
- }
- }
-
- /**
- * Called by the Router to instantiate a new component during the commit phase of a navigation.
- * This method in turn is responsible for calling the `routerOnActivate` hook of its child.
- */
- activate(nextInstruction: ComponentInstruction): Promise {
- var previousInstruction = this._currentInstruction;
- this._currentInstruction = nextInstruction;
- var componentType = nextInstruction.componentType;
- var childRouter = this._parentRouter.childRouter(componentType);
-
- var providers = ReflectiveInjector.resolve([
- {provide: RouteData, useValue: nextInstruction.routeData},
- {provide: RouteParams, useValue: new RouteParams(nextInstruction.params)},
- {provide: routerMod.Router, useValue: childRouter}
- ]);
- this._componentRef =
- this._loader.loadNextToLocation(componentType, this._viewContainerRef, providers);
- return this._componentRef.then((componentRef) => {
- this.activateEvents.emit(componentRef.instance);
- if (hasLifecycleHook(hookMod.routerOnActivate, componentType)) {
- return this._componentRef.then(
- (ref: ComponentRef) =>
- (ref.instance).routerOnActivate(nextInstruction, previousInstruction));
- } else {
- return componentRef;
- }
- });
- }
-
- /**
- * Called by the {@link Router} during the commit phase of a navigation when an outlet
- * reuses a component between different routes.
- * This method in turn is responsible for calling the `routerOnReuse` hook of its child.
- */
- reuse(nextInstruction: ComponentInstruction): Promise {
- var previousInstruction = this._currentInstruction;
- this._currentInstruction = nextInstruction;
-
- // it's possible the component is removed before it can be reactivated (if nested withing
- // another dynamically loaded component, for instance). In that case, we simply activate
- // a new one.
- if (isBlank(this._componentRef)) {
- return this.activate(nextInstruction);
- } else {
- return Promise.resolve(
- hasLifecycleHook(hookMod.routerOnReuse, this._currentInstruction.componentType) ?
- this._componentRef.then(
- (ref: ComponentRef) =>
- (ref.instance).routerOnReuse(nextInstruction, previousInstruction)) :
- true);
- }
- }
-
- /**
- * Called by the {@link Router} when an outlet disposes of a component's contents.
- * This method in turn is responsible for calling the `routerOnDeactivate` hook of its child.
- */
- deactivate(nextInstruction: ComponentInstruction): Promise {
- var next = _resolveToTrue;
- if (isPresent(this._componentRef) && isPresent(this._currentInstruction) &&
- hasLifecycleHook(hookMod.routerOnDeactivate, this._currentInstruction.componentType)) {
- next = this._componentRef.then(
- (ref: ComponentRef) =>
- (ref.instance)
- .routerOnDeactivate(nextInstruction, this._currentInstruction));
- }
- return next.then((_) => {
- if (isPresent(this._componentRef)) {
- var onDispose = this._componentRef.then((ref: ComponentRef) => ref.destroy());
- this._componentRef = null;
- return onDispose;
- }
- });
- }
-
- /**
- * Called by the {@link Router} during recognition phase of a navigation.
- *
- * If this resolves to `false`, the given navigation is cancelled.
- *
- * This method delegates to the child component's `routerCanDeactivate` hook if it exists,
- * and otherwise resolves to true.
- */
- routerCanDeactivate(nextInstruction: ComponentInstruction): Promise {
- if (isBlank(this._currentInstruction)) {
- return _resolveToTrue;
- }
- if (hasLifecycleHook(hookMod.routerCanDeactivate, this._currentInstruction.componentType)) {
- return this._componentRef.then(
- (ref: ComponentRef) =>
- (ref.instance)
- .routerCanDeactivate(nextInstruction, this._currentInstruction));
- } else {
- return _resolveToTrue;
- }
- }
-
- /**
- * Called by the {@link Router} during recognition phase of a navigation.
- *
- * If the new child component has a different Type than the existing child component,
- * this will resolve to `false`. You can't reuse an old component when the new component
- * is of a different Type.
- *
- * Otherwise, this method delegates to the child component's `routerCanReuse` hook if it exists,
- * or resolves to true if the hook is not present.
- */
- routerCanReuse(nextInstruction: ComponentInstruction): Promise {
- var result: any /** TODO #9100 */;
-
- if (isBlank(this._currentInstruction) ||
- this._currentInstruction.componentType != nextInstruction.componentType) {
- result = false;
- } else if (hasLifecycleHook(hookMod.routerCanReuse, this._currentInstruction.componentType)) {
- result = this._componentRef.then(
- (ref: ComponentRef) =>
- (ref.instance).routerCanReuse(nextInstruction, this._currentInstruction));
- } else {
- result = nextInstruction == this._currentInstruction ||
- (isPresent(nextInstruction.params) && isPresent(this._currentInstruction.params) &&
- StringMapWrapper.equals(nextInstruction.params, this._currentInstruction.params));
- }
- return >Promise.resolve(result);
- }
-
- ngOnDestroy(): void { this._parentRouter.unregisterPrimaryOutlet(this); }
-}
diff --git a/modules/@angular/router-deprecated/src/facade b/modules/@angular/router-deprecated/src/facade
deleted file mode 120000
index e084c803c6..0000000000
--- a/modules/@angular/router-deprecated/src/facade
+++ /dev/null
@@ -1 +0,0 @@
-../../facade/src
\ No newline at end of file
diff --git a/modules/@angular/router-deprecated/src/instruction.ts b/modules/@angular/router-deprecated/src/instruction.ts
deleted file mode 100644
index 99cc76db2a..0000000000
--- a/modules/@angular/router-deprecated/src/instruction.ts
+++ /dev/null
@@ -1,329 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {StringMapWrapper} from '../src/facade/collection';
-import {isBlank, isPresent, normalizeBlank} from '../src/facade/lang';
-
-
-
-/**
- * `RouteParams` is an immutable map of parameters for the given route
- * based on the url matcher and optional parameters for that route.
- *
- * You can inject `RouteParams` into the constructor of a component to use it.
- *
- * ### Example
- *
- * ```
- * import {Component} from '@angular/core';
- * import {bootstrap} from '@angular/platform-browser/browser';
- * import {Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig, RouteParams} from
- * 'angular2/router';
- *
- * @Component({directives: [ROUTER_DIRECTIVES]})
- * @RouteConfig([
- * {path: '/user/:id', component: UserCmp, name: 'UserCmp'},
- * ])
- * class AppCmp {}
- *
- * @Component({ template: 'user: {{id}}' })
- * class UserCmp {
- * id: string;
- * constructor(params: RouteParams) {
- * this.id = params.get('id');
- * }
- * }
- *
- * bootstrap(AppCmp, ROUTER_PROVIDERS);
- * ```
- */
-export class RouteParams {
- constructor(public params: {[key: string]: string}) {}
-
- get(param: string): string { return normalizeBlank(StringMapWrapper.get(this.params, param)); }
-}
-
-/**
- * `RouteData` is an immutable map of additional data you can configure in your {@link Route}.
- *
- * You can inject `RouteData` into the constructor of a component to use it.
- *
- * ### Example
- *
- * ```
- * import {Component} from '@angular/core';
- * import {bootstrap} from '@angular/platform-browser/browser';
- * import {Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig, RouteData} from
- * 'angular2/router';
- *
- * @Component({directives: [ROUTER_DIRECTIVES]})
- * @RouteConfig([
- * {path: '/user/:id', component: UserCmp, name: 'UserCmp', data: {isAdmin: true}},
- * ])
- * class AppCmp {}
- *
- * @Component({
- * ...,
- * template: 'user: {{isAdmin}}'
- * })
- * class UserCmp {
- * string: isAdmin;
- * constructor(data: RouteData) {
- * this.isAdmin = data.get('isAdmin');
- * }
- * }
- *
- * bootstrap(AppCmp, ROUTER_PROVIDERS);
- * ```
- */
-export class RouteData {
- constructor(public data: {[key: string]: any} = {}) {}
-
- get(key: string): any { return normalizeBlank(StringMapWrapper.get(this.data, key)); }
-}
-
-export var BLANK_ROUTE_DATA = new RouteData();
-
-/**
- * `Instruction` is a tree of {@link ComponentInstruction}s with all the information needed
- * to transition each component in the app to a given route, including all auxiliary routes.
- *
- * `Instruction`s can be created using {@link Router#generate}, and can be used to
- * perform route changes with {@link Router#navigateByInstruction}.
- *
- * ### Example
- *
- * ```
- * import {Component} from '@angular/core';
- * import {bootstrap} from '@angular/platform-browser/browser';
- * import {Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig} from
- * '@angular/router-deprecated';
- *
- * @Component({directives: [ROUTER_DIRECTIVES]})
- * @RouteConfig([
- * {...},
- * ])
- * class AppCmp {
- * constructor(router: Router) {
- * var instruction = router.generate(['/MyRoute']);
- * router.navigateByInstruction(instruction);
- * }
- * }
- *
- * bootstrap(AppCmp, ROUTER_PROVIDERS);
- * ```
- */
-export abstract class Instruction {
- constructor(
- public component: ComponentInstruction, public child: Instruction,
- public auxInstruction: {[key: string]: Instruction}) {}
-
- get urlPath(): string { return isPresent(this.component) ? this.component.urlPath : ''; }
-
- get urlParams(): string[] { return isPresent(this.component) ? this.component.urlParams : []; }
-
- get specificity(): string {
- var total = '';
- if (isPresent(this.component)) {
- total += this.component.specificity;
- }
- if (isPresent(this.child)) {
- total += this.child.specificity;
- }
- return total;
- }
-
- abstract resolveComponent(): Promise;
-
- /**
- * converts the instruction into a URL string
- */
- toRootUrl(): string { return this.toUrlPath() + this.toUrlQuery(); }
-
- /** @internal */
- _toNonRootUrl(): string {
- return this._stringifyPathMatrixAuxPrefixed() +
- (isPresent(this.child) ? this.child._toNonRootUrl() : '');
- }
-
- toUrlQuery(): string { return this.urlParams.length > 0 ? ('?' + this.urlParams.join('&')) : ''; }
-
- /**
- * Returns a new instruction that shares the state of the existing instruction, but with
- * the given child {@link Instruction} replacing the existing child.
- */
- replaceChild(child: Instruction): Instruction {
- return new ResolvedInstruction(this.component, child, this.auxInstruction);
- }
-
- /**
- * If the final URL for the instruction is ``
- */
- toUrlPath(): string {
- return this.urlPath + this._stringifyAux() +
- (isPresent(this.child) ? this.child._toNonRootUrl() : '');
- }
-
- // default instructions override these
- toLinkUrl(): string {
- return this.urlPath + this._stringifyAux() +
- (isPresent(this.child) ? this.child._toLinkUrl() : '') + this.toUrlQuery();
- }
-
- // this is the non-root version (called recursively)
- /** @internal */
- _toLinkUrl(): string {
- return this._stringifyPathMatrixAuxPrefixed() +
- (isPresent(this.child) ? this.child._toLinkUrl() : '');
- }
-
- /** @internal */
- _stringifyPathMatrixAuxPrefixed(): string {
- var primary = this._stringifyPathMatrixAux();
- if (primary.length > 0) {
- primary = '/' + primary;
- }
- return primary;
- }
-
- /** @internal */
- _stringifyMatrixParams(): string {
- return this.urlParams.length > 0 ? (';' + this.urlParams.join(';')) : '';
- }
-
- /** @internal */
- _stringifyPathMatrixAux(): string {
- if (isBlank(this.component) && isBlank(this.urlPath)) {
- return '';
- }
- return this.urlPath + this._stringifyMatrixParams() + this._stringifyAux();
- }
-
- /** @internal */
- _stringifyAux(): string {
- var routes: any[] /** TODO #9100 */ = [];
- StringMapWrapper.forEach(this.auxInstruction, (auxInstruction: Instruction, _: string) => {
- routes.push(auxInstruction._stringifyPathMatrixAux());
- });
- if (routes.length > 0) {
- return '(' + routes.join('//') + ')';
- }
- return '';
- }
-}
-
-
-/**
- * a resolved instruction has an outlet instruction for itself, but maybe not for...
- */
-export class ResolvedInstruction extends Instruction {
- constructor(
- component: ComponentInstruction, child: Instruction,
- auxInstruction: {[key: string]: Instruction}) {
- super(component, child, auxInstruction);
- }
-
- resolveComponent(): Promise { return Promise.resolve(this.component); }
-}
-
-
-/**
- * Represents a resolved default route
- */
-export class DefaultInstruction extends ResolvedInstruction {
- constructor(component: ComponentInstruction, child: DefaultInstruction) {
- super(component, child, {});
- }
-
- toLinkUrl(): string { return ''; }
-
- /** @internal */
- _toLinkUrl(): string { return ''; }
-}
-
-
-/**
- * Represents a component that may need to do some redirection or lazy loading at a later time.
- */
-export class UnresolvedInstruction extends Instruction {
- constructor(
- private _resolver: () => Promise, private _urlPath: string = '',
- private _urlParams: string[] = []) {
- super(null, null, {});
- }
-
- get urlPath(): string {
- if (isPresent(this.component)) {
- return this.component.urlPath;
- }
- if (isPresent(this._urlPath)) {
- return this._urlPath;
- }
- return '';
- }
-
- get urlParams(): string[] {
- if (isPresent(this.component)) {
- return this.component.urlParams;
- }
- if (isPresent(this._urlParams)) {
- return this._urlParams;
- }
- return [];
- }
-
- resolveComponent(): Promise {
- if (isPresent(this.component)) {
- return Promise.resolve(this.component);
- }
- return this._resolver().then((instruction: Instruction) => {
- this.child = isPresent(instruction) ? instruction.child : null;
- return this.component = isPresent(instruction) ? instruction.component : null;
- });
- }
-}
-
-
-export class RedirectInstruction extends ResolvedInstruction {
- constructor(
- component: ComponentInstruction, child: Instruction,
- auxInstruction: {[key: string]: Instruction}, private _specificity: string) {
- super(component, child, auxInstruction);
- }
-
- get specificity(): string { return this._specificity; }
-}
-
-
-/**
- * A `ComponentInstruction` represents the route state for a single component.
- *
- * `ComponentInstructions` is a public API. Instances of `ComponentInstruction` are passed
- * to route lifecycle hooks, like {@link CanActivate}.
- *
- * `ComponentInstruction`s are [hash consed](https://en.wikipedia.org/wiki/Hash_consing). You should
- * never construct one yourself with "new." Instead, rely on router's internal recognizer to
- * construct `ComponentInstruction`s.
- *
- * You should not modify this object. It should be treated as immutable.
- */
-export class ComponentInstruction {
- reuse: boolean = false;
- public routeData: RouteData;
-
- /**
- * @internal
- */
- constructor(
- public urlPath: string, public urlParams: string[], data: RouteData,
- public componentType: any /** TODO #9100 */, public terminal: boolean,
- public specificity: string, public params: {[key: string]: string} = null,
- public routeName: string) {
- this.routeData = isPresent(data) ? data : BLANK_ROUTE_DATA;
- }
-}
diff --git a/modules/@angular/router-deprecated/src/interfaces.ts b/modules/@angular/router-deprecated/src/interfaces.ts
deleted file mode 100644
index 8c52db43f3..0000000000
--- a/modules/@angular/router-deprecated/src/interfaces.ts
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {global} from '../src/facade/lang';
-
-import {ComponentInstruction} from './instruction';
-
-
-// This is here only so that after TS transpilation the file is not empty.
-// TODO(rado): find a better way to fix this, or remove if likely culprit
-// https://github.com/systemjs/systemjs/issues/487 gets closed.
-var __ignore_me = global;
-
-/**
- * Defines route lifecycle method `routerOnActivate`, which is called by the router at the end of a
- * successful route navigation.
- *
- * For a single component's navigation, only one of either {@link OnActivate} or {@link OnReuse}
- * will be called depending on the result of {@link CanReuse}.
- *
- * The `routerOnActivate` hook is called with two {@link ComponentInstruction}s as parameters, the
- * first
- * representing the current route being navigated to, and the second parameter representing the
- * previous route or `null`.
- *
- * If `routerOnActivate` returns a promise, the route change will wait until the promise settles to
- * instantiate and activate child components.
- *
- * ### Example
- * {@example router_deprecated/ts/on_activate/on_activate_example.ts region='routerOnActivate'}
- */
-export interface OnActivate {
- routerOnActivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction):
- any|Promise;
-}
-
-/**
- * Defines route lifecycle method `routerOnReuse`, which is called by the router at the end of a
- * successful route navigation when {@link CanReuse} is implemented and returns or resolves to true.
- *
- * For a single component's navigation, only one of either {@link OnActivate} or {@link OnReuse}
- * will be called, depending on the result of {@link CanReuse}.
- *
- * The `routerOnReuse` hook is called with two {@link ComponentInstruction}s as parameters, the
- * first
- * representing the current route being navigated to, and the second parameter representing the
- * previous route or `null`.
- *
- * ### Example
- * {@example router_deprecated/ts/reuse/reuse_example.ts region='reuseCmp'}
- */
-export interface OnReuse {
- routerOnReuse(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction): any
- |Promise;
-}
-
-/**
- * Defines route lifecycle method `routerOnDeactivate`, which is called by the router before
- * destroying
- * a component as part of a route change.
- *
- * The `routerOnDeactivate` hook is called with two {@link ComponentInstruction}s as parameters, the
- * first
- * representing the current route being navigated to, and the second parameter representing the
- * previous route.
- *
- * If `routerOnDeactivate` returns a promise, the route change will wait until the promise settles.
- *
- * ### Example
- * {@example router_deprecated/ts/on_deactivate/on_deactivate_example.ts
- * region='routerOnDeactivate'}
- */
-export interface OnDeactivate {
- routerOnDeactivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction):
- any|Promise;
-}
-
-/**
- * Defines route lifecycle method `routerCanReuse`, which is called by the router to determine
- * whether a
- * component should be reused across routes, or whether to destroy and instantiate a new component.
- *
- * The `routerCanReuse` hook is called with two {@link ComponentInstruction}s as parameters, the
- * first
- * representing the current route being navigated to, and the second parameter representing the
- * previous route.
- *
- * If `routerCanReuse` returns or resolves to `true`, the component instance will be reused and the
- * {@link OnDeactivate} hook will be run. If `routerCanReuse` returns or resolves to `false`, a new
- * component will be instantiated, and the existing component will be deactivated and removed as
- * part of the navigation.
- *
- * If `routerCanReuse` throws or rejects, the navigation will be cancelled.
- *
- * ### Example
- * {@example router_deprecated/ts/reuse/reuse_example.ts region='reuseCmp'}
- */
-export interface CanReuse {
- routerCanReuse(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction):
- boolean|Promise;
-}
-
-/**
- * Defines route lifecycle method `routerCanDeactivate`, which is called by the router to determine
- * if a component can be removed as part of a navigation.
- *
- * The `routerCanDeactivate` hook is called with two {@link ComponentInstruction}s as parameters,
- * the
- * first representing the current route being navigated to, and the second parameter
- * representing the previous route.
- *
- * If `routerCanDeactivate` returns or resolves to `false`, the navigation is cancelled. If it
- * returns or
- * resolves to `true`, then the navigation continues, and the component will be deactivated
- * (the {@link OnDeactivate} hook will be run) and removed.
- *
- * If `routerCanDeactivate` throws or rejects, the navigation is also cancelled.
- *
- * ### Example
- * {@example router_deprecated/ts/can_deactivate/can_deactivate_example.ts
- * region='routerCanDeactivate'}
- */
-export interface CanDeactivate {
- routerCanDeactivate(nextInstruction: ComponentInstruction, prevInstruction: ComponentInstruction):
- boolean|Promise;
-}
diff --git a/modules/@angular/router-deprecated/src/lifecycle/lifecycle_annotations.ts b/modules/@angular/router-deprecated/src/lifecycle/lifecycle_annotations.ts
deleted file mode 100644
index 45858c5248..0000000000
--- a/modules/@angular/router-deprecated/src/lifecycle/lifecycle_annotations.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-/**
- * This indirection is needed to free up Component, etc symbols in the public API
- * to be used by the decorator versions of these annotations.
- */
-
-import {makeDecorator} from '../../core_private';
-import {ComponentInstruction} from '../instruction';
-
-import {CanActivate as CanActivateAnnotation} from './lifecycle_annotations_impl';
-
-export {routerCanDeactivate, routerCanReuse, routerOnActivate, routerOnDeactivate, routerOnReuse} from './lifecycle_annotations_impl';
-
-
-/**
- * Defines route lifecycle hook `CanActivate`, which is called by the router to determine
- * if a component can be instantiated as part of a navigation.
- *
- *
- * Note that unlike other lifecycle hooks, this one uses an annotation rather than an interface.
- * This is because the `CanActivate` function is called before the component is instantiated.
- *
- *
- * The `CanActivate` hook is called with two {@link ComponentInstruction}s as parameters, the first
- * representing the current route being navigated to, and the second parameter representing the
- * previous route or `null`.
- *
- * ```typescript
- * @CanActivate((next, prev) => boolean | Promise)
- * ```
- *
- * If `CanActivate` returns or resolves to `false`, the navigation is cancelled.
- * If `CanActivate` throws or rejects, the navigation is also cancelled.
- * If `CanActivate` returns or resolves to `true`, navigation continues, the component is
- * instantiated, and the {@link OnActivate} hook of that component is called if implemented.
- *
- * ### Example
- *
- * {@example router_deprecated/ts/can_activate/can_activate_example.ts region='canActivate' }
- * @Annotation
- */
-export var CanActivate:
- (hook: (next: ComponentInstruction, prev: ComponentInstruction) => Promise| boolean) =>
- ClassDecorator = makeDecorator(CanActivateAnnotation);
diff --git a/modules/@angular/router-deprecated/src/lifecycle/lifecycle_annotations_impl.ts b/modules/@angular/router-deprecated/src/lifecycle/lifecycle_annotations_impl.ts
deleted file mode 100644
index fdef823dc5..0000000000
--- a/modules/@angular/router-deprecated/src/lifecycle/lifecycle_annotations_impl.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-
-export class RouteLifecycleHook {
- constructor(public name: string) {}
-}
-
-export class CanActivate {
- constructor(public fn: Function) {}
-}
-
-export const routerCanReuse: RouteLifecycleHook = new RouteLifecycleHook('routerCanReuse');
-export const routerCanDeactivate: RouteLifecycleHook =
- new RouteLifecycleHook('routerCanDeactivate');
-export const routerOnActivate: RouteLifecycleHook = new RouteLifecycleHook('routerOnActivate');
-export const routerOnReuse: RouteLifecycleHook = new RouteLifecycleHook('routerOnReuse');
-export const routerOnDeactivate: RouteLifecycleHook = new RouteLifecycleHook('routerOnDeactivate');
diff --git a/modules/@angular/router-deprecated/src/lifecycle/route_lifecycle_reflector.ts b/modules/@angular/router-deprecated/src/lifecycle/route_lifecycle_reflector.ts
deleted file mode 100644
index 51c0ac6283..0000000000
--- a/modules/@angular/router-deprecated/src/lifecycle/route_lifecycle_reflector.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Type} from '@angular/core';
-
-import {reflector} from '../../core_private';
-
-import {CanActivate, RouteLifecycleHook} from './lifecycle_annotations_impl';
-
-export function hasLifecycleHook(e: RouteLifecycleHook, type: any /** TODO #9100 */): boolean {
- if (!(type instanceof Type)) return false;
- return e.name in (type).prototype;
-}
-
-export function getCanActivateHook(type: any /** TODO #9100 */): Function {
- var annotations = reflector.annotations(type);
- for (let i = 0; i < annotations.length; i += 1) {
- let annotation = annotations[i];
- if (annotation instanceof CanActivate) {
- return annotation.fn;
- }
- }
-
- return null;
-}
diff --git a/modules/@angular/router-deprecated/src/package.json b/modules/@angular/router-deprecated/src/package.json
deleted file mode 100644
index 58faa47731..0000000000
--- a/modules/@angular/router-deprecated/src/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "@angular/router",
- "version": "0.2.0"
-}
diff --git a/modules/@angular/router-deprecated/src/route_config/route_config_decorator.ts b/modules/@angular/router-deprecated/src/route_config/route_config_decorator.ts
deleted file mode 100644
index b9bea525ee..0000000000
--- a/modules/@angular/router-deprecated/src/route_config/route_config_decorator.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {makeDecorator} from '../../core_private';
-
-import {RouteConfig as RouteConfigAnnotation, RouteDefinition} from './route_config_impl';
-
-export {AsyncRoute, AuxRoute, Redirect, Route, RouteDefinition} from './route_config_impl';
-
-
-// Copied from RouteConfig in route_config_impl.
-/**
- * The `RouteConfig` decorator defines routes for a given component.
- *
- * It takes an array of {@link RouteDefinition}s.
- * @Annotation
- */
-export var RouteConfig: (configs: RouteDefinition[]) => ClassDecorator =
- makeDecorator(RouteConfigAnnotation);
diff --git a/modules/@angular/router-deprecated/src/route_config/route_config_impl.ts b/modules/@angular/router-deprecated/src/route_config/route_config_impl.ts
deleted file mode 100644
index 3169ef9137..0000000000
--- a/modules/@angular/router-deprecated/src/route_config/route_config_impl.ts
+++ /dev/null
@@ -1,204 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Type} from '../facade/lang';
-import {RouteDefinition} from '../route_definition';
-import {RegexSerializer} from '../rules/route_paths/regex_route_path';
-
-export {RouteDefinition} from '../route_definition';
-
-/**
- * The `RouteConfig` decorator defines routes for a given component.
- *
- * It takes an array of {@link RouteDefinition}s.
- */
-export class RouteConfig {
- constructor(public configs: RouteDefinition[]) {}
-}
-
-export abstract class AbstractRoute implements RouteDefinition {
- name: string;
- useAsDefault: boolean;
- path: string;
- regex: string;
- regex_group_names: string[];
- serializer: RegexSerializer;
- data: {[key: string]: any};
-
- constructor({name, useAsDefault, path, regex, regex_group_names, serializer,
- data}: RouteDefinition) {
- this.name = name;
- this.useAsDefault = useAsDefault;
- this.path = path;
- this.regex = regex;
- this.regex_group_names = regex_group_names;
- this.serializer = serializer;
- this.data = data;
- }
-}
-
-/**
- * `Route` is a type of {@link RouteDefinition} used to route a path to a component.
- *
- * It has the following properties:
- * - `path` is a string that uses the route matcher DSL.
- * - `component` a component type.
- * - `name` is an optional `CamelCase` string representing the name of the route.
- * - `data` is an optional property of any type representing arbitrary route metadata for the given
- * route. It is injectable via {@link RouteData}.
- * - `useAsDefault` is a boolean value. If `true`, the child route will be navigated to if no child
- * route is specified during the navigation.
- *
- * ### Example
- * ```
- * import {RouteConfig, Route} from '@angular/router-deprecated';
- *
- * @RouteConfig([
- * new Route({path: '/home', component: HomeCmp, name: 'HomeCmp' })
- * ])
- * class MyApp {}
- * ```
- */
-export class Route extends AbstractRoute {
- component: any;
- aux: string = null;
-
- constructor({name, useAsDefault, path, regex, regex_group_names, serializer, data,
- component}: RouteDefinition) {
- super({
- name: name,
- useAsDefault: useAsDefault,
- path: path,
- regex: regex,
- regex_group_names: regex_group_names,
- serializer: serializer,
- data: data
- });
- this.component = component;
- }
-}
-
-/**
- * `AuxRoute` is a type of {@link RouteDefinition} used to define an auxiliary route.
- *
- * It takes an object with the following properties:
- * - `path` is a string that uses the route matcher DSL.
- * - `component` a component type.
- * - `name` is an optional `CamelCase` string representing the name of the route.
- * - `data` is an optional property of any type representing arbitrary route metadata for the given
- * route. It is injectable via {@link RouteData}.
- *
- * ### Example
- * ```
- * import {RouteConfig, AuxRoute} from '@angular/router-deprecated';
- *
- * @RouteConfig([
- * new AuxRoute({path: '/home', component: HomeCmp})
- * ])
- * class MyApp {}
- * ```
- */
-export class AuxRoute extends AbstractRoute {
- component: any;
-
- constructor({name, useAsDefault, path, regex, regex_group_names, serializer, data,
- component}: RouteDefinition) {
- super({
- name: name,
- useAsDefault: useAsDefault,
- path: path,
- regex: regex,
- regex_group_names: regex_group_names,
- serializer: serializer,
- data: data
- });
- this.component = component;
- }
-}
-
-/**
- * `AsyncRoute` is a type of {@link RouteDefinition} used to route a path to an asynchronously
- * loaded component.
- *
- * It has the following properties:
- * - `path` is a string that uses the route matcher DSL.
- * - `loader` is a function that returns a promise that resolves to a component.
- * - `name` is an optional `CamelCase` string representing the name of the route.
- * - `data` is an optional property of any type representing arbitrary route metadata for the given
- * route. It is injectable via {@link RouteData}.
- * - `useAsDefault` is a boolean value. If `true`, the child route will be navigated to if no child
- * route is specified during the navigation.
- *
- * ### Example
- * ```
- * import {RouteConfig, AsyncRoute} from '@angular/router-deprecated';
- *
- * @RouteConfig([
- * new AsyncRoute({path: '/home', loader: () => Promise.resolve(MyLoadedCmp), name:
- * 'MyLoadedCmp'})
- * ])
- * class MyApp {}
- * ```
- */
-export class AsyncRoute extends AbstractRoute {
- loader: () => Promise;
- aux: string = null;
-
- constructor({name, useAsDefault, path, regex, regex_group_names, serializer, data,
- loader}: RouteDefinition) {
- super({
- name: name,
- useAsDefault: useAsDefault,
- path: path,
- regex: regex,
- regex_group_names: regex_group_names,
- serializer: serializer,
- data: data
- });
- this.loader = loader;
- }
-}
-
-/**
- * `Redirect` is a type of {@link RouteDefinition} used to route a path to a canonical route.
- *
- * It has the following properties:
- * - `path` is a string that uses the route matcher DSL.
- * - `redirectTo` is an array representing the link DSL.
- *
- * Note that redirects **do not** affect how links are generated. For that, see the `useAsDefault`
- * option.
- *
- * ### Example
- * ```
- * import {RouteConfig, Route, Redirect} from '@angular/router-deprecated';
- *
- * @RouteConfig([
- * new Redirect({path: '/', redirectTo: ['/Home'] }),
- * new Route({path: '/home', component: HomeCmp, name: 'Home'})
- * ])
- * class MyApp {}
- * ```
- */
-export class Redirect extends AbstractRoute {
- redirectTo: any[];
-
- constructor({name, useAsDefault, path, regex, regex_group_names, serializer, data,
- redirectTo}: RouteDefinition) {
- super({
- name: name,
- useAsDefault: useAsDefault,
- path: path,
- regex: regex,
- regex_group_names: regex_group_names,
- serializer: serializer,
- data: data
- });
- this.redirectTo = redirectTo;
- }
-}
diff --git a/modules/@angular/router-deprecated/src/route_config/route_config_normalizer.ts b/modules/@angular/router-deprecated/src/route_config/route_config_normalizer.ts
deleted file mode 100644
index eb693f9942..0000000000
--- a/modules/@angular/router-deprecated/src/route_config/route_config_normalizer.ts
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {BaseException} from '../facade/exceptions';
-import {Type, isType} from '../facade/lang';
-import {ComponentDefinition} from '../route_definition';
-import {RouteRegistry} from '../route_registry';
-
-import {AsyncRoute, AuxRoute, Redirect, Route, RouteDefinition} from './route_config_decorator';
-
-
-
-/**
- * Given a JS Object that represents a route config, returns a corresponding Route, AsyncRoute,
- * AuxRoute or Redirect object.
- *
- * Also wraps an AsyncRoute's loader function to add the loaded component's route config to the
- * `RouteRegistry`.
- */
-export function normalizeRouteConfig(
- config: RouteDefinition, registry: RouteRegistry): RouteDefinition {
- if (config instanceof AsyncRoute) {
- var wrappedLoader = wrapLoaderToReconfigureRegistry(config.loader, registry);
- return new AsyncRoute({
- path: config.path,
- loader: wrappedLoader,
- name: config.name,
- data: config.data,
- useAsDefault: config.useAsDefault
- });
- }
- if (config instanceof Route || config instanceof Redirect || config instanceof AuxRoute) {
- return config;
- }
-
- if ((+!!config.component) + (+!!config.redirectTo) + (+!!config.loader) != 1) {
- throw new BaseException(
- `Route config should contain exactly one "component", "loader", or "redirectTo" property.`);
- }
-
- if (config.loader) {
- var wrappedLoader = wrapLoaderToReconfigureRegistry(config.loader, registry);
- return new AsyncRoute({
- path: config.path,
- loader: wrappedLoader,
- name: config.name,
- data: config.data,
- useAsDefault: config.useAsDefault
- });
- }
- if (config.aux) {
- return new AuxRoute({path: config.aux, component: config.component, name: config.name});
- }
- if (config.component) {
- if (typeof config.component == 'object') {
- let componentDefinitionObject = config.component;
- if (componentDefinitionObject.type == 'constructor') {
- return new Route({
- path: config.path,
- component: componentDefinitionObject.constructor,
- name: config.name,
- data: config.data,
- useAsDefault: config.useAsDefault
- });
- } else if (componentDefinitionObject.type == 'loader') {
- return new AsyncRoute({
- path: config.path,
- loader: componentDefinitionObject.loader,
- name: config.name,
- data: config.data,
- useAsDefault: config.useAsDefault
- });
- } else {
- throw new BaseException(
- `Invalid component type "${componentDefinitionObject.type}". Valid types are "constructor" and "loader".`);
- }
- }
- return new Route(<{
- path: string;
- component: Type;
- name?: string;
- data?: {[key: string]: any};
- useAsDefault?: boolean;
- }>config);
- }
-
- if (config.redirectTo) {
- return new Redirect({path: config.path, redirectTo: config.redirectTo});
- }
-
- return config;
-}
-
-
-function wrapLoaderToReconfigureRegistry(loader: Function, registry: RouteRegistry): () =>
- Promise {
- return () => {
- return loader().then((componentType: any /** TODO #9100 */) => {
- registry.configFromComponent(componentType);
- return componentType;
- });
- };
-}
-
-export function assertComponentExists(component: Type, path: string): void {
- if (!isType(component)) {
- throw new BaseException(`Component for route "${path}" is not defined, or is not a class.`);
- }
-}
diff --git a/modules/@angular/router-deprecated/src/route_definition.ts b/modules/@angular/router-deprecated/src/route_definition.ts
deleted file mode 100644
index 06a520ba6e..0000000000
--- a/modules/@angular/router-deprecated/src/route_definition.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Type} from '../src/facade/lang';
-import {RegexSerializer} from './rules/route_paths/regex_route_path';
-
-/**
- * `RouteDefinition` defines a route within a {@link RouteConfig} decorator.
- *
- * Supported keys:
- * - `path` or `aux` (requires exactly one of these)
- * - `component`, `loader`, `redirectTo` (requires exactly one of these)
- * - `name` (optional)
- * - `data` (optional)
- *
- * See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}.
- */
-export interface RouteDefinition {
- path?: string;
- aux?: string;
- regex?: string;
- regex_group_names?: string[];
- serializer?: RegexSerializer;
- component?: Type|ComponentDefinition;
- loader?: () => Promise;
- redirectTo?: any[];
- name?: string;
- data?: any;
- useAsDefault?: boolean;
-}
-
-/**
- * Represents either a component type (`type` is `component`) or a loader function
- * (`type` is `loader`).
- *
- * See also {@link RouteDefinition}.
- */
-export interface ComponentDefinition {
- type: string;
- loader?: () => Promise;
- component?: Type;
-}
diff --git a/modules/@angular/router-deprecated/src/route_registry.ts b/modules/@angular/router-deprecated/src/route_registry.ts
deleted file mode 100644
index f4e536654b..0000000000
--- a/modules/@angular/router-deprecated/src/route_registry.ts
+++ /dev/null
@@ -1,541 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Inject, Injectable, OpaqueToken} from '@angular/core';
-
-import {reflector} from '../core_private';
-import {ListWrapper, Map, StringMapWrapper} from '../src/facade/collection';
-import {BaseException} from '../src/facade/exceptions';
-import {Math, StringWrapper, Type, getTypeNameForDebugging, isArray, isBlank, isPresent, isString, isStringMap, isType} from '../src/facade/lang';
-
-import {DefaultInstruction, Instruction, RedirectInstruction, ResolvedInstruction, UnresolvedInstruction} from './instruction';
-import {AuxRoute, Route, RouteConfig, RouteDefinition} from './route_config/route_config_impl';
-import {assertComponentExists, normalizeRouteConfig} from './route_config/route_config_normalizer';
-import {GeneratedUrl} from './rules/route_paths/route_path';
-import {RuleSet} from './rules/rule_set';
-import {PathMatch, RedirectMatch, RouteMatch} from './rules/rules';
-import {Url, convertUrlParamsToArray, parser} from './url_parser';
-
-var _resolveToNull = Promise.resolve(null);
-
-// A LinkItemArray is an array, which describes a set of routes
-// The items in the array are found in groups:
-// - the first item is the name of the route
-// - the next items are:
-// - an object containing parameters
-// - or an array describing an aux route
-// export type LinkRouteItem = string | Object;
-// export type LinkItem = LinkRouteItem | Array;
-// export type LinkItemArray = Array;
-
-/**
- * Token used to bind the component with the top-level {@link RouteConfig}s for the
- * application.
- *
- * ### Example ([live demo](http://plnkr.co/edit/iRUP8B5OUbxCWQ3AcIDm))
- *
- * ```
- * import {Component} from '@angular/core';
- * import {
- * ROUTER_DIRECTIVES,
- * ROUTER_PROVIDERS,
- * RouteConfig
- * } from '@angular/router-deprecated';
- *
- * @Component({directives: [ROUTER_DIRECTIVES]})
- * @RouteConfig([
- * {...},
- * ])
- * class AppCmp {
- * // ...
- * }
- *
- * bootstrap(AppCmp, [ROUTER_PROVIDERS]);
- * ```
- */
-export const ROUTER_PRIMARY_COMPONENT: OpaqueToken = new OpaqueToken('RouterPrimaryComponent');
-
-
-/**
- * The RouteRegistry holds route configurations for each component in an Angular app.
- * It is responsible for creating Instructions from URLs, and generating URLs based on route and
- * parameters.
- */
-@Injectable()
-export class RouteRegistry {
- private _rules = new Map();
-
- constructor(@Inject(ROUTER_PRIMARY_COMPONENT) private _rootComponent: Type) {}
-
- /**
- * Given a component and a configuration object, add the route to this registry
- */
- config(parentComponent: any, config: RouteDefinition): void {
- config = normalizeRouteConfig(config, this);
-
- // this is here because Dart type guard reasons
- if (config instanceof Route) {
- assertComponentExists(config.component, config.path);
- } else if (config instanceof AuxRoute) {
- assertComponentExists(config.component, config.path);
- }
-
- var rules = this._rules.get(parentComponent);
-
- if (isBlank(rules)) {
- rules = new RuleSet();
- this._rules.set(parentComponent, rules);
- }
-
- var terminal = rules.config(config);
-
- if (config instanceof Route) {
- if (terminal) {
- assertTerminalComponent(config.component, config.path);
- } else {
- this.configFromComponent(config.component);
- }
- }
- }
-
- /**
- * Reads the annotations of a component and configures the registry based on them
- */
- configFromComponent(component: any): void {
- if (!isType(component)) {
- return;
- }
-
- // Don't read the annotations from a type more than once –
- // this prevents an infinite loop if a component routes recursively.
- if (this._rules.has(component)) {
- return;
- }
- var annotations = reflector.annotations(component);
- if (isPresent(annotations)) {
- for (var i = 0; i < annotations.length; i++) {
- var annotation = annotations[i];
-
- if (annotation instanceof RouteConfig) {
- let routeCfgs: RouteDefinition[] = annotation.configs;
- routeCfgs.forEach(config => this.config(component, config));
- }
- }
- }
- }
-
-
- /**
- * Given a URL and a parent component, return the most specific instruction for navigating
- * the application into the state specified by the url
- */
- recognize(url: string, ancestorInstructions: Instruction[]): Promise {
- var parsedUrl = parser.parse(url);
- return this._recognize(parsedUrl, []);
- }
-
-
- /**
- * Recognizes all parent-child routes, but creates unresolved auxiliary routes
- */
- private _recognize(parsedUrl: Url, ancestorInstructions: Instruction[], _aux = false):
- Promise {
- var parentInstruction = ListWrapper.last(ancestorInstructions);
- var parentComponent = isPresent(parentInstruction) ? parentInstruction.component.componentType :
- this._rootComponent;
-
- var rules = this._rules.get(parentComponent);
- if (isBlank(rules)) {
- return _resolveToNull;
- }
-
- // Matches some beginning part of the given URL
- var possibleMatches: Promise[] =
- _aux ? rules.recognizeAuxiliary(parsedUrl) : rules.recognize(parsedUrl);
-
- var matchPromises: Promise[] = possibleMatches.map(
- (candidate: Promise) => candidate.then((candidate: RouteMatch) => {
-
- if (candidate instanceof PathMatch) {
- var auxParentInstructions: Instruction[] =
- ancestorInstructions.length > 0 ? [ListWrapper.last(ancestorInstructions)] : [];
- var auxInstructions =
- this._auxRoutesToUnresolved(candidate.remainingAux, auxParentInstructions);
-
- var instruction = new ResolvedInstruction(candidate.instruction, null, auxInstructions);
-
- if (isBlank(candidate.instruction) || candidate.instruction.terminal) {
- return instruction;
- }
-
- var newAncestorInstructions: Instruction[] = ancestorInstructions.concat([instruction]);
-
- return this._recognize(candidate.remaining, newAncestorInstructions)
- .then((childInstruction) => {
- if (isBlank(childInstruction)) {
- return null;
- }
-
- // redirect instructions are already absolute
- if (childInstruction instanceof RedirectInstruction) {
- return childInstruction;
- }
- instruction.child = childInstruction;
- return instruction;
- });
- }
-
- if (candidate instanceof RedirectMatch) {
- var instruction =
- this.generate(candidate.redirectTo, ancestorInstructions.concat([null]));
- return new RedirectInstruction(
- instruction.component, instruction.child, instruction.auxInstruction,
- candidate.specificity);
- }
- }));
-
- if ((isBlank(parsedUrl) || parsedUrl.path == '') && possibleMatches.length == 0) {
- return Promise.resolve(this.generateDefault(parentComponent));
- }
-
- return Promise.all(matchPromises).then(mostSpecific);
- }
-
- private _auxRoutesToUnresolved(auxRoutes: Url[], parentInstructions: Instruction[]):
- {[key: string]: Instruction} {
- var unresolvedAuxInstructions: {[key: string]: Instruction} = {};
-
- auxRoutes.forEach((auxUrl: Url) => {
- unresolvedAuxInstructions[auxUrl.path] = new UnresolvedInstruction(
- () => { return this._recognize(auxUrl, parentInstructions, true); });
- });
-
- return unresolvedAuxInstructions;
- }
-
-
- /**
- * Given a normalized list with component names and params like: `['user', {id: 3 }]`
- * generates a url with a leading slash relative to the provided `parentComponent`.
- *
- * If the optional param `_aux` is `true`, then we generate starting at an auxiliary
- * route boundary.
- */
- generate(linkParams: any[], ancestorInstructions: Instruction[], _aux = false): Instruction {
- var params = splitAndFlattenLinkParams(linkParams);
- var prevInstruction: any /** TODO #9100 */;
-
- // The first segment should be either '.' (generate from parent) or '' (generate from root).
- // When we normalize above, we strip all the slashes, './' becomes '.' and '/' becomes ''.
- if (ListWrapper.first(params) == '') {
- params.shift();
- prevInstruction = ListWrapper.first(ancestorInstructions);
- ancestorInstructions = [];
- } else {
- prevInstruction = ancestorInstructions.length > 0 ? ancestorInstructions.pop() : null;
-
- if (ListWrapper.first(params) == '.') {
- params.shift();
- } else if (ListWrapper.first(params) == '..') {
- while (ListWrapper.first(params) == '..') {
- if (ancestorInstructions.length <= 0) {
- throw new BaseException(
- `Link "${ListWrapper.toJSON(linkParams)}" has too many "../" segments.`);
- }
- prevInstruction = ancestorInstructions.pop();
- params = ListWrapper.slice(params, 1);
- }
-
- // we're on to implicit child/sibling route
- } else {
- // we must only peak at the link param, and not consume it
- let routeName = ListWrapper.first(params);
- let parentComponentType = this._rootComponent;
- let grandparentComponentType: any /** TODO #9100 */ = null;
-
- if (ancestorInstructions.length > 1) {
- let parentComponentInstruction = ancestorInstructions[ancestorInstructions.length - 1];
- let grandComponentInstruction = ancestorInstructions[ancestorInstructions.length - 2];
-
- parentComponentType = parentComponentInstruction.component.componentType;
- grandparentComponentType = grandComponentInstruction.component.componentType;
- } else if (ancestorInstructions.length == 1) {
- parentComponentType = ancestorInstructions[0].component.componentType;
- grandparentComponentType = this._rootComponent;
- }
-
- // For a link with no leading `./`, `/`, or `../`, we look for a sibling and child.
- // If both exist, we throw. Otherwise, we prefer whichever exists.
- var childRouteExists = this.hasRoute(routeName, parentComponentType);
- var parentRouteExists = isPresent(grandparentComponentType) &&
- this.hasRoute(routeName, grandparentComponentType);
-
- if (parentRouteExists && childRouteExists) {
- let msg =
- `Link "${ListWrapper.toJSON(linkParams)}" is ambiguous, use "./" or "../" to disambiguate.`;
- throw new BaseException(msg);
- }
-
- if (parentRouteExists) {
- prevInstruction = ancestorInstructions.pop();
- }
- }
- }
-
- if (params[params.length - 1] == '') {
- params.pop();
- }
-
- if (params.length > 0 && params[0] == '') {
- params.shift();
- }
-
- if (params.length < 1) {
- let msg = `Link "${ListWrapper.toJSON(linkParams)}" must include a route name.`;
- throw new BaseException(msg);
- }
-
- var generatedInstruction =
- this._generate(params, ancestorInstructions, prevInstruction, _aux, linkParams);
-
- // we don't clone the first (root) element
- for (var i = ancestorInstructions.length - 1; i >= 0; i--) {
- let ancestorInstruction = ancestorInstructions[i];
- if (isBlank(ancestorInstruction)) {
- break;
- }
- generatedInstruction = ancestorInstruction.replaceChild(generatedInstruction);
- }
-
- return generatedInstruction;
- }
-
-
- /*
- * Internal helper that does not make any assertions about the beginning of the link DSL.
- * `ancestorInstructions` are parents that will be cloned.
- * `prevInstruction` is the existing instruction that would be replaced, but which might have
- * aux routes that need to be cloned.
- */
- private _generate(
- linkParams: any[], ancestorInstructions: Instruction[], prevInstruction: Instruction,
- _aux = false, _originalLink: any[]): Instruction {
- let parentComponentType = this._rootComponent;
- let componentInstruction: any /** TODO #9100 */ = null;
- let auxInstructions: {[key: string]: Instruction} = {};
-
- let parentInstruction: Instruction = ListWrapper.last(ancestorInstructions);
- if (isPresent(parentInstruction) && isPresent(parentInstruction.component)) {
- parentComponentType = parentInstruction.component.componentType;
- }
-
- if (linkParams.length == 0) {
- let defaultInstruction = this.generateDefault(parentComponentType);
- if (isBlank(defaultInstruction)) {
- throw new BaseException(
- `Link "${ListWrapper.toJSON(_originalLink)}" does not resolve to a terminal instruction.`);
- }
- return defaultInstruction;
- }
-
- // for non-aux routes, we want to reuse the predecessor's existing primary and aux routes
- // and only override routes for which the given link DSL provides
- if (isPresent(prevInstruction) && !_aux) {
- auxInstructions = StringMapWrapper.merge(prevInstruction.auxInstruction, auxInstructions);
- componentInstruction = prevInstruction.component;
- }
-
- var rules = this._rules.get(parentComponentType);
- if (isBlank(rules)) {
- throw new BaseException(
- `Component "${getTypeNameForDebugging(parentComponentType)}" has no route config.`);
- }
-
- let linkParamIndex = 0;
- let routeParams: {[key: string]: any} = {};
-
- // first, recognize the primary route if one is provided
- if (linkParamIndex < linkParams.length && isString(linkParams[linkParamIndex])) {
- let routeName = linkParams[linkParamIndex];
- if (routeName == '' || routeName == '.' || routeName == '..') {
- throw new BaseException(`"${routeName}/" is only allowed at the beginning of a link DSL.`);
- }
- linkParamIndex += 1;
- if (linkParamIndex < linkParams.length) {
- let linkParam = linkParams[linkParamIndex];
- if (isStringMap(linkParam) && !isArray(linkParam)) {
- routeParams = linkParam;
- linkParamIndex += 1;
- }
- }
- var routeRecognizer = (_aux ? rules.auxRulesByName : rules.rulesByName).get(routeName);
-
- if (isBlank(routeRecognizer)) {
- throw new BaseException(
- `Component "${getTypeNameForDebugging(parentComponentType)}" has no route named "${routeName}".`);
- }
-
- // Create an "unresolved instruction" for async routes
- // we'll figure out the rest of the route when we resolve the instruction and
- // perform a navigation
- if (isBlank(routeRecognizer.handler.componentType)) {
- var generatedUrl: GeneratedUrl = routeRecognizer.generateComponentPathValues(routeParams);
- return new UnresolvedInstruction(() => {
- return routeRecognizer.handler.resolveComponentType().then((_) => {
- return this._generate(
- linkParams, ancestorInstructions, prevInstruction, _aux, _originalLink);
- });
- }, generatedUrl.urlPath, convertUrlParamsToArray(generatedUrl.urlParams));
- }
-
- componentInstruction = _aux ? rules.generateAuxiliary(routeName, routeParams) :
- rules.generate(routeName, routeParams);
- }
-
- // Next, recognize auxiliary instructions.
- // If we have an ancestor instruction, we preserve whatever aux routes are active from it.
- while (linkParamIndex < linkParams.length && isArray(linkParams[linkParamIndex])) {
- let auxParentInstruction: Instruction[] = [parentInstruction];
- let auxInstruction = this._generate(
- linkParams[linkParamIndex], auxParentInstruction, null, true, _originalLink);
-
- // TODO: this will not work for aux routes with parameters or multiple segments
- auxInstructions[auxInstruction.component.urlPath] = auxInstruction;
- linkParamIndex += 1;
- }
-
- var instruction = new ResolvedInstruction(componentInstruction, null, auxInstructions);
-
- // If the component is sync, we can generate resolved child route instructions
- // If not, we'll resolve the instructions at navigation time
- if (isPresent(componentInstruction) && isPresent(componentInstruction.componentType)) {
- let childInstruction: Instruction = null;
- if (componentInstruction.terminal) {
- if (linkParamIndex >= linkParams.length) {
- // TODO: throw that there are extra link params beyond the terminal component
- }
- } else {
- let childAncestorComponents: Instruction[] = ancestorInstructions.concat([instruction]);
- let remainingLinkParams = linkParams.slice(linkParamIndex);
- childInstruction = this._generate(
- remainingLinkParams, childAncestorComponents, null, false, _originalLink);
- }
- instruction.child = childInstruction;
- }
-
- return instruction;
- }
-
- public hasRoute(name: string, parentComponent: any): boolean {
- var rules = this._rules.get(parentComponent);
- if (isBlank(rules)) {
- return false;
- }
- return rules.hasRoute(name);
- }
-
- public generateDefault(componentCursor: Type): Instruction {
- if (isBlank(componentCursor)) {
- return null;
- }
-
- var rules = this._rules.get(componentCursor);
- if (isBlank(rules) || isBlank(rules.defaultRule)) {
- return null;
- }
-
- var defaultChild: any /** TODO #9100 */ = null;
- if (isPresent(rules.defaultRule.handler.componentType)) {
- var componentInstruction = rules.defaultRule.generate({});
- if (!rules.defaultRule.terminal) {
- defaultChild = this.generateDefault(rules.defaultRule.handler.componentType);
- }
- return new DefaultInstruction(componentInstruction, defaultChild);
- }
-
- return new UnresolvedInstruction(() => {
- return rules.defaultRule.handler.resolveComponentType().then(
- (_) => this.generateDefault(componentCursor));
- });
- }
-}
-
-/*
- * Given: ['/a/b', {c: 2}]
- * Returns: ['', 'a', 'b', {c: 2}]
- */
-function splitAndFlattenLinkParams(linkParams: any[]): any[] {
- var accumulation: any[] /** TODO #9100 */ = [];
- linkParams.forEach(function(item: any) {
- if (isString(item)) {
- var strItem: string = item;
- accumulation = accumulation.concat(strItem.split('/'));
- } else {
- accumulation.push(item);
- }
- });
- return accumulation;
-}
-
-
-/*
- * Given a list of instructions, returns the most specific instruction
- */
-function mostSpecific(instructions: Instruction[]): Instruction {
- instructions = instructions.filter((instruction) => isPresent(instruction));
- if (instructions.length == 0) {
- return null;
- }
- if (instructions.length == 1) {
- return instructions[0];
- }
- var first = instructions[0];
- var rest = instructions.slice(1);
- return rest.reduce((instruction: Instruction, contender: Instruction) => {
- if (compareSpecificityStrings(contender.specificity, instruction.specificity) == -1) {
- return contender;
- }
- return instruction;
- }, first);
-}
-
-/*
- * Expects strings to be in the form of "[0-2]+"
- * Returns -1 if string A should be sorted above string B, 1 if it should be sorted after,
- * or 0 if they are the same.
- */
-function compareSpecificityStrings(a: string, b: string): number {
- var l = Math.min(a.length, b.length);
- for (var i = 0; i < l; i += 1) {
- var ai = StringWrapper.charCodeAt(a, i);
- var bi = StringWrapper.charCodeAt(b, i);
- var difference = bi - ai;
- if (difference != 0) {
- return difference;
- }
- }
- return a.length - b.length;
-}
-
-function assertTerminalComponent(component: any /** TODO #9100 */, path: any /** TODO #9100 */) {
- if (!isType(component)) {
- return;
- }
-
- var annotations = reflector.annotations(component);
- if (isPresent(annotations)) {
- for (var i = 0; i < annotations.length; i++) {
- var annotation = annotations[i];
-
- if (annotation instanceof RouteConfig) {
- throw new BaseException(
- `Child routes are not allowed for "${path}". Use "..." on the parent's route path.`);
- }
- }
- }
-}
diff --git a/modules/@angular/router-deprecated/src/router.ts b/modules/@angular/router-deprecated/src/router.ts
deleted file mode 100644
index 6ac36cacce..0000000000
--- a/modules/@angular/router-deprecated/src/router.ts
+++ /dev/null
@@ -1,603 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Location} from '@angular/common';
-import {Inject, Injectable} from '@angular/core';
-
-import {EventEmitter} from '../src/facade/async';
-import {Map, StringMapWrapper} from '../src/facade/collection';
-import {BaseException} from '../src/facade/exceptions';
-import {Type, isBlank, isPresent} from '../src/facade/lang';
-
-import {RouterOutlet} from './directives/router_outlet';
-import {ComponentInstruction, DefaultInstruction, Instruction} from './instruction';
-import {getCanActivateHook} from './lifecycle/route_lifecycle_reflector';
-import {RouteDefinition} from './route_config/route_config_impl';
-import {ROUTER_PRIMARY_COMPONENT, RouteRegistry} from './route_registry';
-
-let _resolveToTrue = Promise.resolve(true);
-let _resolveToFalse = Promise.resolve(false);
-
-/**
- * The `Router` is responsible for mapping URLs to components.
- *
- * You can see the state of the router by inspecting the read-only field `router.navigating`.
- * This may be useful for showing a spinner, for instance.
- *
- * ## Concepts
- *
- * Routers and component instances have a 1:1 correspondence.
- *
- * The router holds reference to a number of {@link RouterOutlet}.
- * An outlet is a placeholder that the router dynamically fills in depending on the current URL.
- *
- * When the router navigates from a URL, it must first recognize it and serialize it into an
- * `Instruction`.
- * The router uses the `RouteRegistry` to get an `Instruction`.
- */
-@Injectable()
-export class Router {
- navigating: boolean = false;
- lastNavigationAttempt: string;
- /**
- * The current `Instruction` for the router
- */
- public currentInstruction: Instruction = null;
-
- private _currentNavigation: Promise = _resolveToTrue;
- private _outlet: RouterOutlet = null;
-
- private _auxRouters = new Map();
- private _childRouter: Router;
-
- private _subject: EventEmitter = new EventEmitter();
-
-
- constructor(
- public registry: RouteRegistry, public parent: Router, public hostComponent: any,
- public root?: Router) {}
-
- /**
- * Constructs a child router. You probably don't need to use this unless you're writing a reusable
- * component.
- */
- childRouter(hostComponent: any): Router {
- return this._childRouter = new ChildRouter(this, hostComponent);
- }
-
-
- /**
- * Constructs a child router. You probably don't need to use this unless you're writing a reusable
- * component.
- */
- auxRouter(hostComponent: any): Router { return new ChildRouter(this, hostComponent); }
-
- /**
- * Register an outlet to be notified of primary route changes.
- *
- * You probably don't need to use this unless you're writing a reusable component.
- */
- registerPrimaryOutlet(outlet: RouterOutlet): Promise {
- if (isPresent(outlet.name)) {
- throw new BaseException(`registerPrimaryOutlet expects to be called with an unnamed outlet.`);
- }
-
- if (isPresent(this._outlet)) {
- throw new BaseException(`Primary outlet is already registered.`);
- }
-
- this._outlet = outlet;
- if (isPresent(this.currentInstruction)) {
- return this.commit(this.currentInstruction, false);
- }
- return _resolveToTrue;
- }
-
- /**
- * Unregister an outlet (because it was destroyed, etc).
- *
- * You probably don't need to use this unless you're writing a custom outlet implementation.
- */
- unregisterPrimaryOutlet(outlet: RouterOutlet): void {
- if (isPresent(outlet.name)) {
- throw new BaseException(`registerPrimaryOutlet expects to be called with an unnamed outlet.`);
- }
- this._outlet = null;
- }
-
-
- /**
- * Register an outlet to notified of auxiliary route changes.
- *
- * You probably don't need to use this unless you're writing a reusable component.
- */
- registerAuxOutlet(outlet: RouterOutlet): Promise {
- var outletName = outlet.name;
- if (isBlank(outletName)) {
- throw new BaseException(`registerAuxOutlet expects to be called with an outlet with a name.`);
- }
-
- var router = this.auxRouter(this.hostComponent);
-
- this._auxRouters.set(outletName, router);
- router._outlet = outlet;
-
- var auxInstruction: any /** TODO #9100 */;
- if (isPresent(this.currentInstruction) &&
- isPresent(auxInstruction = this.currentInstruction.auxInstruction[outletName])) {
- return router.commit(auxInstruction);
- }
- return _resolveToTrue;
- }
-
-
- /**
- * Given an instruction, returns `true` if the instruction is currently active,
- * otherwise `false`.
- */
- isRouteActive(instruction: Instruction): boolean {
- var router: Router = this;
- var currentInstruction = this.currentInstruction;
-
- if (isBlank(currentInstruction)) {
- return false;
- }
-
- // `instruction` corresponds to the root router
- while (isPresent(router.parent) && isPresent(instruction.child)) {
- router = router.parent;
- instruction = instruction.child;
- }
-
- let reason = true;
-
- // check the instructions in depth
- do {
- if (isBlank(instruction.component) || isBlank(currentInstruction.component) ||
- currentInstruction.component.routeName != instruction.component.routeName) {
- return false;
- }
- if (isPresent(instruction.component.params)) {
- StringMapWrapper.forEach(
- instruction.component.params,
- (value: any /** TODO #9100 */, key: any /** TODO #9100 */) => {
- if (currentInstruction.component.params[key] !== value) {
- reason = false;
- }
- });
- }
- currentInstruction = currentInstruction.child;
- instruction = instruction.child;
- } while (isPresent(currentInstruction) && isPresent(instruction) &&
- !(instruction instanceof DefaultInstruction) && reason);
-
- // ignore DefaultInstruction
- return reason && (isBlank(instruction) || instruction instanceof DefaultInstruction);
- }
-
-
- /**
- * Dynamically update the routing configuration and trigger a navigation.
- *
- * ### Usage
- *
- * ```
- * router.config([
- * { 'path': '/', 'component': IndexComp },
- * { 'path': '/user/:id', 'component': UserComp },
- * ]);
- * ```
- */
- config(definitions: RouteDefinition[]): Promise {
- definitions.forEach(
- (routeDefinition) => { this.registry.config(this.hostComponent, routeDefinition); });
- return this.renavigate();
- }
-
-
- /**
- * Navigate based on the provided Route Link DSL. It's preferred to navigate with this method
- * over `navigateByUrl`.
- *
- * ### Usage
- *
- * This method takes an array representing the Route Link DSL:
- * ```
- * ['./MyCmp', {param: 3}]
- * ```
- * See the {@link RouterLink} directive for more.
- */
- navigate(linkParams: any[]): Promise {
- var instruction = this.generate(linkParams);
- return this.navigateByInstruction(instruction, false);
- }
-
-
- /**
- * Navigate to a URL. Returns a promise that resolves when navigation is complete.
- * It's preferred to navigate with `navigate` instead of this method, since URLs are more brittle.
- *
- * If the given URL begins with a `/`, router will navigate absolutely.
- * If the given URL does not begin with `/`, the router will navigate relative to this component.
- */
- navigateByUrl(url: string, _skipLocationChange: boolean = false): Promise {
- return this._currentNavigation = this._currentNavigation.then((_) => {
- this.lastNavigationAttempt = url;
- this._startNavigating();
- return this._afterPromiseFinishNavigating(this.recognize(url).then((instruction) => {
- if (isBlank(instruction)) {
- return false;
- }
- return this._navigate(instruction, _skipLocationChange);
- }));
- });
- }
-
-
- /**
- * Navigate via the provided instruction. Returns a promise that resolves when navigation is
- * complete.
- */
- navigateByInstruction(instruction: Instruction, _skipLocationChange: boolean = false):
- Promise {
- if (isBlank(instruction)) {
- return _resolveToFalse;
- }
- return this._currentNavigation = this._currentNavigation.then((_) => {
- this._startNavigating();
- return this._afterPromiseFinishNavigating(this._navigate(instruction, _skipLocationChange));
- });
- }
-
- /** @internal */
- _settleInstruction(instruction: Instruction): Promise {
- return instruction.resolveComponent().then((_) => {
- var unsettledInstructions: Array> = [];
-
- if (isPresent(instruction.component)) {
- instruction.component.reuse = false;
- }
-
- if (isPresent(instruction.child)) {
- unsettledInstructions.push(this._settleInstruction(instruction.child));
- }
-
- StringMapWrapper.forEach(
- instruction.auxInstruction, (instruction: Instruction, _: any /** TODO #9100 */) => {
- unsettledInstructions.push(this._settleInstruction(instruction));
- });
- return Promise.all(unsettledInstructions);
- });
- }
-
- /** @internal */
- _navigate(instruction: Instruction, _skipLocationChange: boolean): Promise {
- return this._settleInstruction(instruction)
- .then((_) => this._routerCanReuse(instruction))
- .then((_) => this._canActivate(instruction))
- .then((result: boolean) => {
- if (!result) {
- return false;
- }
- return this._routerCanDeactivate(instruction).then((result: boolean) => {
- if (result) {
- return this.commit(instruction, _skipLocationChange).then((_) => {
- this._emitNavigationFinish(instruction.component);
- return true;
- });
- }
- });
- });
- }
-
- private _emitNavigationFinish(instruction: ComponentInstruction): void {
- this._subject.emit({status: 'success', instruction});
- }
- /** @internal */
- _emitNavigationFail(url: string): void { this._subject.emit({status: 'fail', url}); }
-
- private _afterPromiseFinishNavigating(promise: Promise): Promise {
- return promise.then(() => this._finishNavigating()).catch((err) => {
- this._finishNavigating();
- throw err;
- });
- }
-
- /*
- * Recursively set reuse flags
- */
- /** @internal */
- _routerCanReuse(instruction: Instruction): Promise {
- if (isBlank(this._outlet)) {
- return _resolveToFalse;
- }
- if (isBlank(instruction.component)) {
- return _resolveToTrue;
- }
- return this._outlet.routerCanReuse(instruction.component).then((result) => {
- instruction.component.reuse = result;
- if (result && isPresent(this._childRouter) && isPresent(instruction.child)) {
- return this._childRouter._routerCanReuse(instruction.child);
- }
- });
- }
-
- private _canActivate(nextInstruction: Instruction): Promise {
- return canActivateOne(nextInstruction, this.currentInstruction);
- }
-
- private _routerCanDeactivate(instruction: Instruction): Promise {
- if (isBlank(this._outlet)) {
- return _resolveToTrue;
- }
- var next: Promise;
- var childInstruction: Instruction = null;
- var reuse: boolean = false;
- var componentInstruction: ComponentInstruction = null;
- if (isPresent(instruction)) {
- childInstruction = instruction.child;
- componentInstruction = instruction.component;
- reuse = isBlank(instruction.component) || instruction.component.reuse;
- }
- if (reuse) {
- next = _resolveToTrue;
- } else {
- next = this._outlet.routerCanDeactivate(componentInstruction);
- }
- // TODO: aux route lifecycle hooks
- return next.then((result): boolean | Promise => {
- if (result == false) {
- return false;
- }
- if (isPresent(this._childRouter)) {
- // TODO: ideally, this closure would map to async-await in Dart.
- // For now, casting to any to suppress an error.
- return this._childRouter._routerCanDeactivate(childInstruction);
- }
- return true;
- });
- }
-
- /**
- * Updates this router and all descendant routers according to the given instruction
- */
- commit(instruction: Instruction, _skipLocationChange: boolean = false): Promise {
- this.currentInstruction = instruction;
-
- var next: Promise = _resolveToTrue;
- if (isPresent(this._outlet) && isPresent(instruction.component)) {
- var componentInstruction = instruction.component;
- if (componentInstruction.reuse) {
- next = this._outlet.reuse(componentInstruction);
- } else {
- next =
- this.deactivate(instruction).then((_) => this._outlet.activate(componentInstruction));
- }
- if (isPresent(instruction.child)) {
- next = next.then((_) => {
- if (isPresent(this._childRouter)) {
- return this._childRouter.commit(instruction.child);
- }
- });
- }
- }
-
- var promises: Promise[] = [];
- this._auxRouters.forEach((router, name) => {
- if (isPresent(instruction.auxInstruction[name])) {
- promises.push(router.commit(instruction.auxInstruction[name]));
- }
- });
-
- return next.then((_) => Promise.all(promises));
- }
-
-
- /** @internal */
- _startNavigating(): void { this.navigating = true; }
-
- /** @internal */
- _finishNavigating(): void { this.navigating = false; }
-
-
- /**
- * Subscribe to URL updates from the router
- */
- subscribe(onNext: (value: any) => void, onError?: (value: any) => void): Object {
- return this._subject.subscribe({next: onNext, error: onError});
- }
-
-
- /**
- * Removes the contents of this router's outlet and all descendant outlets
- */
- deactivate(instruction: Instruction): Promise {
- var childInstruction: Instruction = null;
- var componentInstruction: ComponentInstruction = null;
- if (isPresent(instruction)) {
- childInstruction = instruction.child;
- componentInstruction = instruction.component;
- }
- var next: Promise = _resolveToTrue;
- if (isPresent(this._childRouter)) {
- next = this._childRouter.deactivate(childInstruction);
- }
- if (isPresent(this._outlet)) {
- next = next.then((_) => this._outlet.deactivate(componentInstruction));
- }
-
- // TODO: handle aux routes
-
- return next;
- }
-
-
- /**
- * Given a URL, returns an instruction representing the component graph
- */
- recognize(url: string): Promise {
- var ancestorComponents = this._getAncestorInstructions();
- return this.registry.recognize(url, ancestorComponents);
- }
-
- private _getAncestorInstructions(): Instruction[] {
- var ancestorInstructions: Instruction[] = [this.currentInstruction];
- var ancestorRouter: Router = this;
- while (isPresent(ancestorRouter = ancestorRouter.parent)) {
- ancestorInstructions.unshift(ancestorRouter.currentInstruction);
- }
- return ancestorInstructions;
- }
-
-
- /**
- * Navigates to either the last URL successfully navigated to, or the last URL requested if the
- * router has yet to successfully navigate.
- */
- renavigate(): Promise {
- if (isBlank(this.lastNavigationAttempt)) {
- return this._currentNavigation;
- }
- return this.navigateByUrl(this.lastNavigationAttempt);
- }
-
-
- /**
- * Generate an `Instruction` based on the provided Route Link DSL.
- */
- generate(linkParams: any[]): Instruction {
- var ancestorInstructions = this._getAncestorInstructions();
- return this.registry.generate(linkParams, ancestorInstructions);
- }
-}
-
-@Injectable()
-export class RootRouter extends Router {
- /** @internal */
- _location: Location;
- /** @internal */
- _locationSub: Object;
-
- constructor(
- registry: RouteRegistry, location: Location,
- @Inject(ROUTER_PRIMARY_COMPONENT) primaryComponent: Type) {
- super(registry, null, primaryComponent);
- this.root = this;
- this._location = location;
- this._locationSub = this._location.subscribe((change) => {
- // we call recognize ourselves
- this.recognize(change['url']).then((instruction) => {
- if (isPresent(instruction)) {
- this.navigateByInstruction(instruction, isPresent(change['pop'])).then((_) => {
- // this is a popstate event; no need to change the URL
- if (isPresent(change['pop']) && change['type'] != 'hashchange') {
- return;
- }
- var emitPath = instruction.toUrlPath();
- var emitQuery = instruction.toUrlQuery();
- if (emitPath.length > 0 && emitPath[0] != '/') {
- emitPath = '/' + emitPath;
- }
-
- // We've opted to use pushstate and popState APIs regardless of whether you
- // an app uses HashLocationStrategy or PathLocationStrategy.
- // However, apps that are migrating might have hash links that operate outside
- // angular to which routing must respond.
- // Therefore we know that all hashchange events occur outside Angular.
- // To support these cases where we respond to hashchanges and redirect as a
- // result, we need to replace the top item on the stack.
- if (change['type'] == 'hashchange') {
- if (instruction.toRootUrl() != this._location.path()) {
- this._location.replaceState(emitPath, emitQuery);
- }
- } else {
- this._location.go(emitPath, emitQuery);
- }
- });
- } else {
- this._emitNavigationFail(change['url']);
- }
- });
- });
-
- this.registry.configFromComponent(primaryComponent);
- this.navigateByUrl(location.path());
- }
-
- commit(instruction: Instruction, _skipLocationChange: boolean = false): Promise {
- var emitPath = instruction.toUrlPath();
- var emitQuery = instruction.toUrlQuery();
- if (emitPath.length > 0 && emitPath[0] != '/') {
- emitPath = '/' + emitPath;
- }
- var promise = super.commit(instruction);
- if (!_skipLocationChange) {
- if (this._location.isCurrentPathEqualTo(emitPath, emitQuery)) {
- promise = promise.then((_) => { this._location.replaceState(emitPath, emitQuery); });
- } else {
- promise = promise.then((_) => { this._location.go(emitPath, emitQuery); });
- }
- }
- return promise;
- }
-
- ngOnDestroy() { this.dispose(); }
-
- dispose(): void {
- if (isPresent(this._locationSub)) {
- (this._locationSub).unsubscribe();
- this._locationSub = null;
- }
- }
-}
-
-class ChildRouter extends Router {
- constructor(parent: Router, hostComponent: any /** TODO #9100 */) {
- super(parent.registry, parent, hostComponent, parent.root);
- this.parent = parent;
- }
-
-
- navigateByUrl(url: string, _skipLocationChange: boolean = false): Promise {
- // Delegate navigation to the root router
- return this.parent.navigateByUrl(url, _skipLocationChange);
- }
-
- navigateByInstruction(instruction: Instruction, _skipLocationChange: boolean = false):
- Promise {
- // Delegate navigation to the root router
- return this.parent.navigateByInstruction(instruction, _skipLocationChange);
- }
-}
-
-
-function canActivateOne(
- nextInstruction: Instruction, prevInstruction: Instruction): Promise {
- var next = _resolveToTrue;
- if (isBlank(nextInstruction.component)) {
- return next;
- }
- if (isPresent(nextInstruction.child)) {
- next = canActivateOne(
- nextInstruction.child, isPresent(prevInstruction) ? prevInstruction.child : null);
- }
- return next.then((result: boolean): boolean => {
- if (result == false) {
- return false;
- }
- if (nextInstruction.component.reuse) {
- return true;
- }
- var hook = getCanActivateHook(nextInstruction.component.componentType);
- if (isPresent(hook)) {
- return hook(
- nextInstruction.component, isPresent(prevInstruction) ? prevInstruction.component : null);
- }
- return true;
- });
-}
diff --git a/modules/@angular/router-deprecated/src/router_providers.ts b/modules/@angular/router-deprecated/src/router_providers.ts
deleted file mode 100644
index 8ecd3293a2..0000000000
--- a/modules/@angular/router-deprecated/src/router_providers.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {PlatformLocation} from '@angular/common';
-import {BrowserPlatformLocation} from '@angular/platform-browser';
-
-import {ROUTER_PROVIDERS_COMMON} from './router_providers_common';
-
-
-/**
- * A list of providers. To use the router, you must add this to your application.
- *
- * ### Example ([live demo](http://plnkr.co/edit/iRUP8B5OUbxCWQ3AcIDm))
- *
- * ```
- * import {Component} from '@angular/core';
- * import {
- * ROUTER_DIRECTIVES,
- * ROUTER_PROVIDERS,
- * RouteConfig
- * } from '@angular/router-deprecated';
- *
- * @Component({directives: [ROUTER_DIRECTIVES]})
- * @RouteConfig([
- * {...},
- * ])
- * class AppCmp {
- * // ...
- * }
- *
- * bootstrap(AppCmp, [ROUTER_PROVIDERS]);
- * ```
- */
-export const ROUTER_PROVIDERS: any[] = [
- ROUTER_PROVIDERS_COMMON,
- ({provide: PlatformLocation, useClass: BrowserPlatformLocation}),
-];
-
-/**
- * Use {@link ROUTER_PROVIDERS} instead.
- *
- * @deprecated
- */
-export const ROUTER_BINDINGS = ROUTER_PROVIDERS;
diff --git a/modules/@angular/router-deprecated/src/router_providers_common.ts b/modules/@angular/router-deprecated/src/router_providers_common.ts
deleted file mode 100644
index 03c0eb8aa7..0000000000
--- a/modules/@angular/router-deprecated/src/router_providers_common.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Location, LocationStrategy, PathLocationStrategy} from '@angular/common';
-import {ApplicationRef} from '@angular/core';
-
-import {BaseException} from '../src/facade/exceptions';
-import {Type} from '../src/facade/lang';
-
-import {ROUTER_PRIMARY_COMPONENT, RouteRegistry} from './route_registry';
-import {RootRouter, Router} from './router';
-
-
-/**
- * The Platform agnostic ROUTER PROVIDERS
- */
-export const ROUTER_PROVIDERS_COMMON: any[] = [
- RouteRegistry, {provide: LocationStrategy, useClass: PathLocationStrategy}, Location, {
- provide: Router,
- useFactory: routerFactory,
- deps: [RouteRegistry, Location, ROUTER_PRIMARY_COMPONENT]
- },
- {
- provide: ROUTER_PRIMARY_COMPONENT,
- useFactory: routerPrimaryComponentFactory,
- deps: [ApplicationRef]
- }
-];
-
-function routerFactory(
- registry: RouteRegistry, location: Location, primaryComponent: Type): RootRouter {
- return new RootRouter(registry, location, primaryComponent);
-}
-
-function routerPrimaryComponentFactory(app: ApplicationRef): Type {
- if (app.componentTypes.length == 0) {
- throw new BaseException('Bootstrap at least one component before injecting Router.');
- }
- return app.componentTypes[0];
-}
diff --git a/modules/@angular/router-deprecated/src/rules/route_handlers/async_route_handler.ts b/modules/@angular/router-deprecated/src/rules/route_handlers/async_route_handler.ts
deleted file mode 100644
index 4a1fb79509..0000000000
--- a/modules/@angular/router-deprecated/src/rules/route_handlers/async_route_handler.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Type, isPresent} from '../../facade/lang';
-import {BLANK_ROUTE_DATA, RouteData} from '../../instruction';
-
-import {RouteHandler} from './route_handler';
-
-
-export class AsyncRouteHandler implements RouteHandler {
- /** @internal */
- _resolvedComponent: Promise = null;
- componentType: Type;
- public data: RouteData;
-
- constructor(private _loader: () => Promise, data: {[key: string]: any} = null) {
- this.data = isPresent(data) ? new RouteData(data) : BLANK_ROUTE_DATA;
- }
-
- resolveComponentType(): Promise {
- if (isPresent(this._resolvedComponent)) {
- return this._resolvedComponent;
- }
-
- return this._resolvedComponent = this._loader().then((componentType) => {
- this.componentType = componentType;
- return componentType;
- });
- }
-}
diff --git a/modules/@angular/router-deprecated/src/rules/route_handlers/route_handler.ts b/modules/@angular/router-deprecated/src/rules/route_handlers/route_handler.ts
deleted file mode 100644
index bf8e5558c3..0000000000
--- a/modules/@angular/router-deprecated/src/rules/route_handlers/route_handler.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Type} from '../../facade/lang';
-import {RouteData} from '../../instruction';
-
-export interface RouteHandler {
- componentType: Type;
- resolveComponentType(): Promise;
- data: RouteData;
-}
diff --git a/modules/@angular/router-deprecated/src/rules/route_handlers/sync_route_handler.ts b/modules/@angular/router-deprecated/src/rules/route_handlers/sync_route_handler.ts
deleted file mode 100644
index 34490c63a2..0000000000
--- a/modules/@angular/router-deprecated/src/rules/route_handlers/sync_route_handler.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Type, isPresent} from '../../facade/lang';
-import {BLANK_ROUTE_DATA, RouteData} from '../../instruction';
-
-import {RouteHandler} from './route_handler';
-
-
-export class SyncRouteHandler implements RouteHandler {
- public data: RouteData;
-
- /** @internal */
- _resolvedComponent: Promise = null;
-
- constructor(public componentType: Type, data?: {[key: string]: any}) {
- this._resolvedComponent = Promise.resolve(componentType);
- this.data = isPresent(data) ? new RouteData(data) : BLANK_ROUTE_DATA;
- }
-
- resolveComponentType(): Promise { return this._resolvedComponent; }
-}
diff --git a/modules/@angular/router-deprecated/src/rules/route_paths/param_route_path.ts b/modules/@angular/router-deprecated/src/rules/route_paths/param_route_path.ts
deleted file mode 100644
index 83f74a45c8..0000000000
--- a/modules/@angular/router-deprecated/src/rules/route_paths/param_route_path.ts
+++ /dev/null
@@ -1,321 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {StringMapWrapper} from '../../facade/collection';
-import {BaseException} from '../../facade/exceptions';
-import {StringWrapper, isBlank, isPresent} from '../../facade/lang';
-import {RootUrl, Url, convertUrlParamsToArray} from '../../url_parser';
-import {TouchMap, normalizeString} from '../../utils';
-
-import {GeneratedUrl, MatchedUrl, RoutePath} from './route_path';
-
-
-
-/**
- * `ParamRoutePath`s are made up of `PathSegment`s, each of which can
- * match a segment of a URL. Different kind of `PathSegment`s match
- * URL segments in different ways...
- */
-interface PathSegment {
- name: string;
- generate(params: TouchMap): string;
- match(path: string): boolean;
- specificity: string;
- hash: string;
-}
-
-/**
- * Identified by a `...` URL segment. This indicates that the
- * Route will continue to be matched by child `Router`s.
- */
-class ContinuationPathSegment implements PathSegment {
- name: string = '';
- specificity = '';
- hash = '...';
- generate(params: TouchMap): string { return ''; }
- match(path: string): boolean { return true; }
-}
-
-/**
- * Identified by a string not starting with a `:` or `*`.
- * Only matches the URL segments that equal the segment path
- */
-class StaticPathSegment implements PathSegment {
- name: string = '';
- specificity = '2';
- hash: string;
- constructor(public path: string) { this.hash = path; }
- match(path: string): boolean { return path == this.path; }
- generate(params: TouchMap): string { return this.path; }
-}
-
-/**
- * Identified by a string starting with `:`. Indicates a segment
- * that can contain a value that will be extracted and provided to
- * a matching `Instruction`.
- */
-class DynamicPathSegment implements PathSegment {
- static paramMatcher = /^:([^\/]+)$/;
- specificity = '1';
- hash = ':';
- constructor(public name: string) {}
- match(path: string): boolean { return path.length > 0; }
- generate(params: TouchMap): string {
- if (!StringMapWrapper.contains(params.map, this.name)) {
- throw new BaseException(
- `Route generator for '${this.name}' was not included in parameters passed.`);
- }
- return encodeDynamicSegment(normalizeString(params.get(this.name)));
- }
-}
-
-/**
- * Identified by a string starting with `*` Indicates that all the following
- * segments match this route and that the value of these segments should
- * be provided to a matching `Instruction`.
- */
-class StarPathSegment implements PathSegment {
- static wildcardMatcher = /^\*([^\/]+)$/;
- specificity = '0';
- hash = '*';
- constructor(public name: string) {}
- match(path: string): boolean { return true; }
- generate(params: TouchMap): string { return normalizeString(params.get(this.name)); }
-}
-
-/**
- * Parses a URL string using a given matcher DSL, and generates URLs from param maps
- */
-export class ParamRoutePath implements RoutePath {
- specificity: string;
- terminal: boolean = true;
- hash: string;
-
- private _segments: PathSegment[];
-
- /**
- * Takes a string representing the matcher DSL
- */
- constructor(public routePath: string) {
- this._assertValidPath(routePath);
-
- this._parsePathString(routePath);
- this.specificity = this._calculateSpecificity();
- this.hash = this._calculateHash();
-
- var lastSegment = this._segments[this._segments.length - 1];
- this.terminal = !(lastSegment instanceof ContinuationPathSegment);
- }
-
- matchUrl(url: Url): MatchedUrl {
- var nextUrlSegment = url;
- var currentUrlSegment: Url;
- var positionalParams = {};
- var captured: string[] = [];
-
- for (var i = 0; i < this._segments.length; i += 1) {
- var pathSegment = this._segments[i];
-
- if (pathSegment instanceof ContinuationPathSegment) {
- break;
- }
- currentUrlSegment = nextUrlSegment;
-
- if (isPresent(currentUrlSegment)) {
- // the star segment consumes all of the remaining URL, including matrix params
- if (pathSegment instanceof StarPathSegment) {
- (positionalParams as any /** TODO #9100 */)[pathSegment.name] =
- currentUrlSegment.toString();
- captured.push(currentUrlSegment.toString());
- nextUrlSegment = null;
- break;
- }
-
- captured.push(currentUrlSegment.path);
-
- if (pathSegment instanceof DynamicPathSegment) {
- (positionalParams as any /** TODO #9100 */)[pathSegment.name] =
- decodeDynamicSegment(currentUrlSegment.path);
- } else if (!pathSegment.match(currentUrlSegment.path)) {
- return null;
- }
-
- nextUrlSegment = currentUrlSegment.child;
- } else if (!pathSegment.match('')) {
- return null;
- }
- }
-
- if (this.terminal && isPresent(nextUrlSegment)) {
- return null;
- }
-
- var urlPath = captured.join('/');
-
- var auxiliary: any[] /** TODO #9100 */ = [];
- var urlParams: any[] /** TODO #9100 */ = [];
- var allParams = positionalParams;
- if (isPresent(currentUrlSegment)) {
- // If this is the root component, read query params. Otherwise, read matrix params.
- var paramsSegment = url instanceof RootUrl ? url : currentUrlSegment;
-
- if (isPresent(paramsSegment.params)) {
- allParams = StringMapWrapper.merge(paramsSegment.params, positionalParams);
- urlParams = convertUrlParamsToArray(paramsSegment.params);
- } else {
- allParams = positionalParams;
- }
- auxiliary = currentUrlSegment.auxiliary;
- }
-
- return new MatchedUrl(urlPath, urlParams, allParams, auxiliary, nextUrlSegment);
- }
-
-
- generateUrl(params: {[key: string]: any}): GeneratedUrl {
- var paramTokens = new TouchMap(params);
-
- var path: any[] /** TODO #9100 */ = [];
-
- for (var i = 0; i < this._segments.length; i++) {
- let segment = this._segments[i];
- if (!(segment instanceof ContinuationPathSegment)) {
- path.push(segment.generate(paramTokens));
- }
- }
- var urlPath = path.join('/');
-
- var nonPositionalParams = paramTokens.getUnused();
- var urlParams = nonPositionalParams;
-
- return new GeneratedUrl(urlPath, urlParams);
- }
-
-
- toString(): string { return this.routePath; }
-
- private _parsePathString(routePath: string) {
- // normalize route as not starting with a "/". Recognition will
- // also normalize.
- if (routePath.startsWith('/')) {
- routePath = routePath.substring(1);
- }
-
- var segmentStrings = routePath.split('/');
- this._segments = [];
-
- var limit = segmentStrings.length - 1;
- for (var i = 0; i <= limit; i++) {
- var segment = segmentStrings[i], match: RegExpMatchArray;
-
- if (isPresent(match = segment.match(DynamicPathSegment.paramMatcher))) {
- this._segments.push(new DynamicPathSegment(match[1]));
- } else if (isPresent(match = segment.match(StarPathSegment.wildcardMatcher))) {
- this._segments.push(new StarPathSegment(match[1]));
- } else if (segment == '...') {
- if (i < limit) {
- throw new BaseException(
- `Unexpected "..." before the end of the path for "${routePath}".`);
- }
- this._segments.push(new ContinuationPathSegment());
- } else {
- this._segments.push(new StaticPathSegment(segment));
- }
- }
- }
-
- private _calculateSpecificity(): string {
- // The "specificity" of a path is used to determine which route is used when multiple routes
- // match
- // a URL. Static segments (like "/foo") are the most specific, followed by dynamic segments
- // (like
- // "/:id"). Star segments add no specificity. Segments at the start of the path are more
- // specific
- // than proceeding ones.
- //
- // The code below uses place values to combine the different types of segments into a single
- // string that we can sort later. Each static segment is marked as a specificity of "2," each
- // dynamic segment is worth "1" specificity, and stars are worth "0" specificity.
- var i: any /** TODO #9100 */, length = this._segments.length,
- specificity: any /** TODO #9100 */;
- if (length == 0) {
- // a single slash (or "empty segment" is as specific as a static segment
- specificity += '2';
- } else {
- specificity = '';
- for (i = 0; i < length; i++) {
- specificity += this._segments[i].specificity;
- }
- }
- return specificity;
- }
-
- private _calculateHash(): string {
- // this function is used to determine whether a route config path like `/foo/:id` collides with
- // `/foo/:name`
- var i: any /** TODO #9100 */, length = this._segments.length;
- var hashParts: any[] /** TODO #9100 */ = [];
- for (i = 0; i < length; i++) {
- hashParts.push(this._segments[i].hash);
- }
- return hashParts.join('/');
- }
-
- private _assertValidPath(path: string) {
- if (StringWrapper.contains(path, '#')) {
- throw new BaseException(
- `Path "${path}" should not include "#". Use "HashLocationStrategy" instead.`);
- }
- const illegalCharacter = path.match(ParamRoutePath.RESERVED_CHARS);
- if (isPresent(illegalCharacter)) {
- throw new BaseException(
- `Path "${path}" contains "${illegalCharacter[0]}" which is not allowed in a route config.`);
- }
- }
- static RESERVED_CHARS = new RegExp('//|\\(|\\)|;|\\?|=');
-}
-
-let REGEXP_PERCENT = /%/g;
-let REGEXP_SLASH = /\//g;
-let REGEXP_OPEN_PARENT = /\(/g;
-let REGEXP_CLOSE_PARENT = /\)/g;
-let REGEXP_SEMICOLON = /;/g;
-
-function encodeDynamicSegment(value: string): string {
- if (isBlank(value)) {
- return null;
- }
-
- value = StringWrapper.replaceAll(value, REGEXP_PERCENT, '%25');
- value = StringWrapper.replaceAll(value, REGEXP_SLASH, '%2F');
- value = StringWrapper.replaceAll(value, REGEXP_OPEN_PARENT, '%28');
- value = StringWrapper.replaceAll(value, REGEXP_CLOSE_PARENT, '%29');
- value = StringWrapper.replaceAll(value, REGEXP_SEMICOLON, '%3B');
-
- return value;
-}
-
-let REGEXP_ENC_SEMICOLON = /%3B/ig;
-let REGEXP_ENC_CLOSE_PARENT = /%29/ig;
-let REGEXP_ENC_OPEN_PARENT = /%28/ig;
-let REGEXP_ENC_SLASH = /%2F/ig;
-let REGEXP_ENC_PERCENT = /%25/ig;
-
-function decodeDynamicSegment(value: string): string {
- if (isBlank(value)) {
- return null;
- }
-
- value = StringWrapper.replaceAll(value, REGEXP_ENC_SEMICOLON, ';');
- value = StringWrapper.replaceAll(value, REGEXP_ENC_CLOSE_PARENT, ')');
- value = StringWrapper.replaceAll(value, REGEXP_ENC_OPEN_PARENT, '(');
- value = StringWrapper.replaceAll(value, REGEXP_ENC_SLASH, '/');
- value = StringWrapper.replaceAll(value, REGEXP_ENC_PERCENT, '%');
-
- return value;
-}
diff --git a/modules/@angular/router-deprecated/src/rules/route_paths/regex_route_path.ts b/modules/@angular/router-deprecated/src/rules/route_paths/regex_route_path.ts
deleted file mode 100644
index f3222ff8c9..0000000000
--- a/modules/@angular/router-deprecated/src/rules/route_paths/regex_route_path.ts
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {BaseException} from '@angular/core';
-
-import {isBlank} from '../../facade/lang';
-import {Url} from '../../url_parser';
-
-import {GeneratedUrl, MatchedUrl, RoutePath} from './route_path';
-
-
-export interface RegexSerializer { (params: {[key: string]: any}): GeneratedUrl; }
-
-function computeNumberOfRegexGroups(regex: string): number {
- // cleverly compute regex groups by appending an alternative empty matching
- // pattern and match against an empty string, the resulting match still
- // receives all the other groups
- var testRegex = new RegExp(regex + '|');
- return testRegex.exec('').length;
-}
-
-export class RegexRoutePath implements RoutePath {
- public hash: string;
- public terminal: boolean = true;
- public specificity: string = '2';
-
- private _regex: RegExp;
-
- constructor(
- private _reString: string, private _serializer: RegexSerializer,
- private _groupNames?: Array) {
- this.hash = this._reString;
- this._regex = new RegExp(this._reString);
- if (this._groupNames != null) {
- var groups = computeNumberOfRegexGroups(this._reString);
- if (groups != _groupNames.length) {
- throw new BaseException(
- `Regex group names [${this._groupNames.join(',')}] must contain names for \
-each matching group and a name for the complete match as its first element of regex \
-'${this._reString}'. ${groups} group names are expected.`);
- }
- }
- }
-
- matchUrl(url: Url): MatchedUrl {
- var urlPath = url.toString();
- var params: {[key: string]: string} = {};
- var match = urlPath.match(this._regex);
-
- if (isBlank(match)) {
- return null;
- }
-
- for (let i = 0; i < match.length; i += 1) {
- params[this._groupNames != null ? this._groupNames[i] : i.toString()] = match[i];
- }
-
- return new MatchedUrl(urlPath, [], params, [], null);
- }
-
- generateUrl(params: {[key: string]: any}): GeneratedUrl { return this._serializer(params); }
-
- toString(): string { return this._reString; }
-}
diff --git a/modules/@angular/router-deprecated/src/rules/route_paths/route_path.ts b/modules/@angular/router-deprecated/src/rules/route_paths/route_path.ts
deleted file mode 100644
index a128b05826..0000000000
--- a/modules/@angular/router-deprecated/src/rules/route_paths/route_path.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Url} from '../../url_parser';
-
-export class MatchedUrl {
- constructor(
- public urlPath: string, public urlParams: string[], public allParams: {[key: string]: any},
- public auxiliary: Url[], public rest: Url) {}
-}
-
-
-export class GeneratedUrl {
- constructor(public urlPath: string, public urlParams: {[key: string]: any}) {}
-}
-
-export interface RoutePath {
- specificity: string;
- terminal: boolean;
- hash: string;
- matchUrl(url: Url): MatchedUrl;
- generateUrl(params: {[key: string]: any}): GeneratedUrl;
- toString(): string;
-}
diff --git a/modules/@angular/router-deprecated/src/rules/rule_set.ts b/modules/@angular/router-deprecated/src/rules/rule_set.ts
deleted file mode 100644
index ff0e2eb3cc..0000000000
--- a/modules/@angular/router-deprecated/src/rules/rule_set.ts
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Map} from '../facade/collection';
-import {BaseException} from '../facade/exceptions';
-import {isBlank, isFunction, isPresent} from '../facade/lang';
-import {ComponentInstruction} from '../instruction';
-import {AsyncRoute, AuxRoute, Redirect, Route, RouteDefinition} from '../route_config/route_config_impl';
-import {Url} from '../url_parser';
-
-import {AsyncRouteHandler} from './route_handlers/async_route_handler';
-import {SyncRouteHandler} from './route_handlers/sync_route_handler';
-import {ParamRoutePath} from './route_paths/param_route_path';
-import {RegexRoutePath} from './route_paths/regex_route_path';
-import {RoutePath} from './route_paths/route_path';
-import {AbstractRule, PathMatch, RedirectRule, RouteMatch, RouteRule} from './rules';
-
-
-
-/**
- * A `RuleSet` is responsible for recognizing routes for a particular component.
- * It is consumed by `RouteRegistry`, which knows how to recognize an entire hierarchy of
- * components.
- */
-export class RuleSet {
- rulesByName = new Map();
-
- // map from name to rule
- auxRulesByName = new Map();
-
- // map from starting path to rule
- auxRulesByPath = new Map();
-
- // TODO: optimize this into a trie
- rules: AbstractRule[] = [];
-
- // the rule to use automatically when recognizing or generating from this rule set
- defaultRule: RouteRule = null;
-
- /**
- * Configure additional rules in this rule set from a route definition
- * @returns {boolean} true if the config is terminal
- */
- config(config: RouteDefinition): boolean {
- let handler: any /** TODO #9100 */;
-
- if (isPresent(config.name) && config.name[0].toUpperCase() != config.name[0]) {
- let suggestedName = config.name[0].toUpperCase() + config.name.substring(1);
- throw new BaseException(
- `Route "${config.path}" with name "${config.name}" does not begin with an uppercase letter. Route names should be PascalCase like "${suggestedName}".`);
- }
-
- if (config instanceof AuxRoute) {
- handler = new SyncRouteHandler(config.component, config.data);
- let routePath = this._getRoutePath(config);
- let auxRule = new RouteRule(routePath, handler, config.name);
- this.auxRulesByPath.set(routePath.toString(), auxRule);
- if (isPresent(config.name)) {
- this.auxRulesByName.set(config.name, auxRule);
- }
- return auxRule.terminal;
- }
-
- let useAsDefault = false;
-
- if (config instanceof Redirect) {
- let routePath = this._getRoutePath(config);
- let redirector = new RedirectRule(routePath, config.redirectTo);
- this._assertNoHashCollision(redirector.hash, config.path);
- this.rules.push(redirector);
- return true;
- }
-
- if (config instanceof Route) {
- handler = new SyncRouteHandler(config.component, config.data);
- useAsDefault = isPresent(config.useAsDefault) && config.useAsDefault;
- } else if (config instanceof AsyncRoute) {
- handler = new AsyncRouteHandler(config.loader, config.data);
- useAsDefault = isPresent(config.useAsDefault) && config.useAsDefault;
- }
- let routePath = this._getRoutePath(config);
- let newRule = new RouteRule(routePath, handler, config.name);
-
- this._assertNoHashCollision(newRule.hash, config.path);
-
- if (useAsDefault) {
- if (isPresent(this.defaultRule)) {
- throw new BaseException(`Only one route can be default`);
- }
- this.defaultRule = newRule;
- }
-
- this.rules.push(newRule);
- if (isPresent(config.name)) {
- this.rulesByName.set(config.name, newRule);
- }
- return newRule.terminal;
- }
-
-
- /**
- * Given a URL, returns a list of `RouteMatch`es, which are partial recognitions for some route.
- */
- recognize(urlParse: Url): Promise[] {
- var solutions: any[] /** TODO #9100 */ = [];
-
- this.rules.forEach((routeRecognizer: AbstractRule) => {
- var pathMatch = routeRecognizer.recognize(urlParse);
-
- if (isPresent(pathMatch)) {
- solutions.push(pathMatch);
- }
- });
-
- // handle cases where we are routing just to an aux route
- if (solutions.length == 0 && isPresent(urlParse) && urlParse.auxiliary.length > 0) {
- return [Promise.resolve(new PathMatch(null, null, urlParse.auxiliary))];
- }
-
- return solutions;
- }
-
- recognizeAuxiliary(urlParse: Url): Promise[] {
- var routeRecognizer: RouteRule = this.auxRulesByPath.get(urlParse.path);
- if (isPresent(routeRecognizer)) {
- return [routeRecognizer.recognize(urlParse)];
- }
-
- return [Promise.resolve(null)];
- }
-
- hasRoute(name: string): boolean { return this.rulesByName.has(name); }
-
- componentLoaded(name: string): boolean {
- return this.hasRoute(name) && isPresent(this.rulesByName.get(name).handler.componentType);
- }
-
- loadComponent(name: string): Promise {
- return this.rulesByName.get(name).handler.resolveComponentType();
- }
-
- generate(name: string, params: any): ComponentInstruction {
- var rule: RouteRule = this.rulesByName.get(name);
- if (isBlank(rule)) {
- return null;
- }
- return rule.generate(params);
- }
-
- generateAuxiliary(name: string, params: any): ComponentInstruction {
- var rule: RouteRule = this.auxRulesByName.get(name);
- if (isBlank(rule)) {
- return null;
- }
- return rule.generate(params);
- }
-
- private _assertNoHashCollision(hash: string, path: any /** TODO #9100 */) {
- this.rules.forEach((rule) => {
- if (hash == rule.hash) {
- throw new BaseException(
- `Configuration '${path}' conflicts with existing route '${rule.path}'`);
- }
- });
- }
-
- private _getRoutePath(config: RouteDefinition): RoutePath {
- if (isPresent(config.regex)) {
- if (isFunction(config.serializer)) {
- return new RegexRoutePath(config.regex, config.serializer, config.regex_group_names);
- } else {
- throw new BaseException(
- `Route provides a regex property, '${config.regex}', but no serializer property`);
- }
- }
- if (isPresent(config.path)) {
- // Auxiliary routes do not have a slash at the start
- let path = (config instanceof AuxRoute && config.path.startsWith('/')) ?
- config.path.substring(1) :
- config.path;
- return new ParamRoutePath(path);
- }
- throw new BaseException('Route must provide either a path or regex property');
- }
-}
diff --git a/modules/@angular/router-deprecated/src/rules/rules.ts b/modules/@angular/router-deprecated/src/rules/rules.ts
deleted file mode 100644
index 80d8557a2d..0000000000
--- a/modules/@angular/router-deprecated/src/rules/rules.ts
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Map} from '../facade/collection';
-import {BaseException} from '../facade/exceptions';
-import {isBlank, isPresent} from '../facade/lang';
-import {ComponentInstruction} from '../instruction';
-import {Url, convertUrlParamsToArray} from '../url_parser';
-
-import {RouteHandler} from './route_handlers/route_handler';
-import {GeneratedUrl, RoutePath} from './route_paths/route_path';
-
-
-
-// RouteMatch objects hold information about a match between a rule and a URL
-export abstract class RouteMatch {}
-
-export class PathMatch extends RouteMatch {
- constructor(
- public instruction: ComponentInstruction, public remaining: Url, public remainingAux: Url[]) {
- super();
- }
-}
-
-export class RedirectMatch extends RouteMatch {
- constructor(public redirectTo: any[], public specificity: any /** TODO #9100 */) { super(); }
-}
-
-// Rules are responsible for recognizing URL segments and generating instructions
-export interface AbstractRule {
- hash: string;
- path: string;
- recognize(beginningSegment: Url): Promise;
- generate(params: {[key: string]: any}): ComponentInstruction;
-}
-
-export class RedirectRule implements AbstractRule {
- public hash: string;
-
- constructor(private _pathRecognizer: RoutePath, public redirectTo: any[]) {
- this.hash = this._pathRecognizer.hash;
- }
-
- get path() { return this._pathRecognizer.toString(); }
- set path(val) { throw new BaseException('you cannot set the path of a RedirectRule directly'); }
-
- /**
- * Returns `null` or a `ParsedUrl` representing the new path to match
- */
- recognize(beginningSegment: Url): Promise {
- var match: any /** TODO #9100 */ = null;
- if (isPresent(this._pathRecognizer.matchUrl(beginningSegment))) {
- match = new RedirectMatch(this.redirectTo, this._pathRecognizer.specificity);
- }
- return Promise.resolve(match);
- }
-
- generate(params: {[key: string]: any}): ComponentInstruction {
- throw new BaseException(`Tried to generate a redirect.`);
- }
-}
-
-
-// represents something like '/foo/:bar'
-export class RouteRule implements AbstractRule {
- specificity: string;
- terminal: boolean;
- hash: string;
-
- private _cache: Map = new Map();
-
- // TODO: cache component instruction instances by params and by ParsedUrl instance
-
- constructor(
- private _routePath: RoutePath, public handler: RouteHandler, private _routeName: string) {
- this.specificity = this._routePath.specificity;
- this.hash = this._routePath.hash;
- this.terminal = this._routePath.terminal;
- }
-
- get path() { return this._routePath.toString(); }
- set path(val) { throw new BaseException('you cannot set the path of a RouteRule directly'); }
-
- recognize(beginningSegment: Url): Promise {
- var res = this._routePath.matchUrl(beginningSegment);
- if (isBlank(res)) {
- return null;
- }
-
- return this.handler.resolveComponentType().then((_) => {
- var componentInstruction = this._getInstruction(res.urlPath, res.urlParams, res.allParams);
- return new PathMatch(componentInstruction, res.rest, res.auxiliary);
- });
- }
-
- generate(params: {[key: string]: any}): ComponentInstruction {
- var generated = this._routePath.generateUrl(params);
- var urlPath = generated.urlPath;
- var urlParams = generated.urlParams;
- return this._getInstruction(urlPath, convertUrlParamsToArray(urlParams), params);
- }
-
- generateComponentPathValues(params: {[key: string]: any}): GeneratedUrl {
- return this._routePath.generateUrl(params);
- }
-
- private _getInstruction(urlPath: string, urlParams: string[], params: {[key: string]: any}):
- ComponentInstruction {
- if (isBlank(this.handler.componentType)) {
- throw new BaseException(`Tried to get instruction before the type was loaded.`);
- }
- var hashKey = urlPath + '?' + urlParams.join('&');
- if (this._cache.has(hashKey)) {
- return this._cache.get(hashKey);
- }
- var instruction = new ComponentInstruction(
- urlPath, urlParams, this.handler.data, this.handler.componentType, this.terminal,
- this.specificity, params, this._routeName);
- this._cache.set(hashKey, instruction);
-
- return instruction;
- }
-}
diff --git a/modules/@angular/router-deprecated/src/url_parser.ts b/modules/@angular/router-deprecated/src/url_parser.ts
deleted file mode 100644
index dad81a6d62..0000000000
--- a/modules/@angular/router-deprecated/src/url_parser.ts
+++ /dev/null
@@ -1,252 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {StringMapWrapper} from '../src/facade/collection';
-import {BaseException} from '../src/facade/exceptions';
-import {isBlank, isPresent} from '../src/facade/lang';
-
-export function convertUrlParamsToArray(urlParams: {[key: string]: any}): string[] {
- var paramsArray: any[] /** TODO #9100 */ = [];
- if (isBlank(urlParams)) {
- return [];
- }
- StringMapWrapper.forEach(
- urlParams, (value: any /** TODO #9100 */, key: any /** TODO #9100 */) => {
- paramsArray.push((value === true) ? key : key + '=' + value);
- });
- return paramsArray;
-}
-
-// Convert an object of url parameters into a string that can be used in an URL
-export function serializeParams(urlParams: {[key: string]: any}, joiner = '&'): string {
- return convertUrlParamsToArray(urlParams).join(joiner);
-}
-
-/**
- * This class represents a parsed URL
- */
-export class Url {
- constructor(
- public path: string, public child: Url = null, public auxiliary: Url[] = [],
- public params: {[key: string]: any} = {}) {}
-
- toString(): string {
- return this.path + this._matrixParamsToString() + this._auxToString() + this._childString();
- }
-
- segmentToString(): string { return this.path + this._matrixParamsToString(); }
-
- /** @internal */
- _auxToString(): string {
- return this.auxiliary.length > 0 ?
- ('(' + this.auxiliary.map(sibling => sibling.toString()).join('//') + ')') :
- '';
- }
-
- private _matrixParamsToString(): string {
- var paramString = serializeParams(this.params, ';');
- if (paramString.length > 0) {
- return ';' + paramString;
- }
- return '';
- }
-
- /** @internal */
- _childString(): string { return isPresent(this.child) ? ('/' + this.child.toString()) : ''; }
-}
-
-export class RootUrl extends Url {
- constructor(path: string, child: Url = null, auxiliary: Url[] = [], params: {[key: string]:
- any} = null) {
- super(path, child, auxiliary, params);
- }
-
- toString(): string {
- return this.path + this._auxToString() + this._childString() + this._queryParamsToString();
- }
-
- segmentToString(): string { return this.path + this._queryParamsToString(); }
-
- private _queryParamsToString(): string {
- if (isBlank(this.params)) {
- return '';
- }
-
- return '?' + serializeParams(this.params);
- }
-}
-
-export function pathSegmentsToUrl(pathSegments: string[]): Url {
- var url = new Url(pathSegments[pathSegments.length - 1]);
- for (var i = pathSegments.length - 2; i >= 0; i -= 1) {
- url = new Url(pathSegments[i], url);
- }
- return url;
-}
-
-const SEGMENT_RE = /^[^\/\(\)\?;=]+/;
-function matchUrlSegment(str: string): string {
- const match = str.match(SEGMENT_RE);
- return match !== null ? match[0] : '';
-}
-const QUERY_PARAM_VALUE_RE = /^[^\(\)\?;]+/;
-function matchUrlQueryParamValue(str: string): string {
- var match = str.match(QUERY_PARAM_VALUE_RE);
- return match !== null ? match[0] : '';
-}
-
-export class UrlParser {
- private _remaining: string;
-
- peekStartsWith(str: string): boolean { return this._remaining.startsWith(str); }
-
- capture(str: string): void {
- if (!this._remaining.startsWith(str)) {
- throw new BaseException(`Expected "${str}".`);
- }
- this._remaining = this._remaining.substring(str.length);
- }
-
- parse(url: string): Url {
- this._remaining = url;
- if (url == '' || url == '/') {
- return new Url('');
- }
- return this.parseRoot();
- }
-
- // segment + (aux segments) + (query params)
- parseRoot(): RootUrl {
- if (this.peekStartsWith('/')) {
- this.capture('/');
- }
- var path = matchUrlSegment(this._remaining);
- this.capture(path);
-
- var aux: Url[] = [];
- if (this.peekStartsWith('(')) {
- aux = this.parseAuxiliaryRoutes();
- }
- if (this.peekStartsWith(';')) {
- // TODO: should these params just be dropped?
- this.parseMatrixParams();
- }
- var child: any /** TODO #9100 */ = null;
- if (this.peekStartsWith('/') && !this.peekStartsWith('//')) {
- this.capture('/');
- child = this.parseSegment();
- }
- var queryParams: {[key: string]: any} = null;
- if (this.peekStartsWith('?')) {
- queryParams = this.parseQueryParams();
- }
- return new RootUrl(path, child, aux, queryParams);
- }
-
- // segment + (matrix params) + (aux segments)
- parseSegment(): Url {
- if (this._remaining.length == 0) {
- return null;
- }
- if (this.peekStartsWith('/')) {
- this.capture('/');
- }
- var path = matchUrlSegment(this._remaining);
- this.capture(path);
-
- var matrixParams: {[key: string]: any} = null;
- if (this.peekStartsWith(';')) {
- matrixParams = this.parseMatrixParams();
- }
- var aux: Url[] = [];
- if (this.peekStartsWith('(')) {
- aux = this.parseAuxiliaryRoutes();
- }
- var child: Url = null;
- if (this.peekStartsWith('/') && !this.peekStartsWith('//')) {
- this.capture('/');
- child = this.parseSegment();
- }
- return new Url(path, child, aux, matrixParams);
- }
-
- parseQueryParams(): {[key: string]: any} {
- var params: {[key: string]: any} = {};
- this.capture('?');
- this.parseQueryParam(params);
- while (this._remaining.length > 0 && this.peekStartsWith('&')) {
- this.capture('&');
- this.parseQueryParam(params);
- }
- return params;
- }
-
- parseMatrixParams(): {[key: string]: any} {
- var params: {[key: string]: any} = {};
- while (this._remaining.length > 0 && this.peekStartsWith(';')) {
- this.capture(';');
- this.parseParam(params);
- }
- return params;
- }
-
- parseParam(params: {[key: string]: any}): void {
- var key = matchUrlSegment(this._remaining);
- if (isBlank(key)) {
- return;
- }
- this.capture(key);
- var value: any = true;
- if (this.peekStartsWith('=')) {
- this.capture('=');
- var valueMatch = matchUrlSegment(this._remaining);
- if (isPresent(valueMatch)) {
- value = valueMatch;
- this.capture(value);
- }
- }
-
- params[key] = value;
- }
-
- parseQueryParam(params: {[key: string]: any}): void {
- var key = matchUrlSegment(this._remaining);
- if (isBlank(key)) {
- return;
- }
- this.capture(key);
- var value: any = true;
- if (this.peekStartsWith('=')) {
- this.capture('=');
- var valueMatch = matchUrlQueryParamValue(this._remaining);
- if (isPresent(valueMatch)) {
- value = valueMatch;
- this.capture(value);
- }
- }
-
- params[key] = value;
- }
-
- parseAuxiliaryRoutes(): Url[] {
- var routes: Url[] = [];
- this.capture('(');
-
- while (!this.peekStartsWith(')') && this._remaining.length > 0) {
- routes.push(this.parseSegment());
- if (this.peekStartsWith('//')) {
- this.capture('//');
- }
- }
- this.capture(')');
-
- return routes;
- }
-}
-
-export var parser = new UrlParser();
diff --git a/modules/@angular/router-deprecated/src/utils.ts b/modules/@angular/router-deprecated/src/utils.ts
deleted file mode 100644
index 3fdb97be9b..0000000000
--- a/modules/@angular/router-deprecated/src/utils.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {StringMapWrapper} from '../src/facade/collection';
-import {isBlank, isPresent} from '../src/facade/lang';
-
-export class TouchMap {
- map: {[key: string]: string} = {};
- keys: {[key: string]: boolean} = {};
-
- constructor(map: {[key: string]: any}) {
- if (isPresent(map)) {
- StringMapWrapper.forEach(map, (value: any /** TODO #9100 */, key: any /** TODO #9100 */) => {
- this.map[key] = isPresent(value) ? value.toString() : null;
- this.keys[key] = true;
- });
- }
- }
-
- get(key: string): string {
- StringMapWrapper.delete(this.keys, key);
- return this.map[key];
- }
-
- getUnused(): {[key: string]: any} {
- var unused: {[key: string]: any} = {};
- var keys = StringMapWrapper.keys(this.keys);
- keys.forEach(key => unused[key] = StringMapWrapper.get(this.map, key));
- return unused;
- }
-}
-
-
-export function normalizeString(obj: any): string {
- if (isBlank(obj)) {
- return null;
- } else {
- return obj.toString();
- }
-}
diff --git a/modules/@angular/router-deprecated/test/directives/router_link_spec.ts b/modules/@angular/router-deprecated/test/directives/router_link_spec.ts
deleted file mode 100644
index 654e82cba8..0000000000
--- a/modules/@angular/router-deprecated/test/directives/router_link_spec.ts
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Location} from '@angular/common';
-import {Component} from '@angular/core';
-import {TestComponentBuilder} from '@angular/core/testing';
-import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
-import {By} from '@angular/platform-browser/src/dom/debug/by';
-import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
-import {ComponentInstruction, Route, RouteParams, RouteRegistry, Router, RouterLink, RouterOutlet} from '@angular/router-deprecated';
-import {ResolvedInstruction} from '@angular/router-deprecated/src/instruction';
-
-import {SpyLocation, SpyRouter} from '../spies';
-
-let dummyInstruction = new ResolvedInstruction(
- new ComponentInstruction('detail', [], null, null, true, '0', null, 'Detail'), null, {});
-
-export function main() {
- describe('routerLink directive', function() {
- var tcb: TestComponentBuilder;
-
- beforeEachProviders(() => [{provide: Location, useValue: makeDummyLocation()}, {
- provide: Router,
- useValue: makeDummyRouter()
- }]);
-
- beforeEach(
- inject([TestComponentBuilder], (tcBuilder: any /** TODO #9100 */) => { tcb = tcBuilder; }));
-
- it('should update a[href] attribute',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
-
- tcb.createAsync(TestComponent).then((testComponent) => {
- testComponent.detectChanges();
- let anchorElement =
- testComponent.debugElement.query(By.css('a.detail-view')).nativeElement;
- expect(getDOM().getAttribute(anchorElement, 'href')).toEqual('detail');
- async.done();
- });
- }));
-
-
- it('should call router.navigate when a link is clicked',
- inject(
- [AsyncTestCompleter, Router],
- (async: AsyncTestCompleter, router: any /** TODO #9100 */) => {
-
- tcb.createAsync(TestComponent).then((testComponent) => {
- testComponent.detectChanges();
- // TODO: shouldn't this be just 'click' rather than '^click'?
- testComponent.debugElement.query(By.css('a.detail-view'))
- .triggerEventHandler('click', null);
- expect(router.spy('navigateByInstruction')).toHaveBeenCalledWith(dummyInstruction);
- async.done();
- });
- }));
-
- it('should call router.navigate when a link is clicked if target is _self',
- inject(
- [AsyncTestCompleter, Router],
- (async: AsyncTestCompleter, router: any /** TODO #9100 */) => {
-
- tcb.createAsync(TestComponent).then((testComponent) => {
- testComponent.detectChanges();
- testComponent.debugElement.query(By.css('a.detail-view-self'))
- .triggerEventHandler('click', null);
- expect(router.spy('navigateByInstruction')).toHaveBeenCalledWith(dummyInstruction);
- async.done();
- });
- }));
-
- it('should NOT call router.navigate when a link is clicked if target is set to other than _self',
- inject(
- [AsyncTestCompleter, Router],
- (async: AsyncTestCompleter, router: any /** TODO #9100 */) => {
-
- tcb.createAsync(TestComponent).then((testComponent) => {
- testComponent.detectChanges();
- testComponent.debugElement.query(By.css('a.detail-view-blank'))
- .triggerEventHandler('click', null);
- expect(router.spy('navigateByInstruction')).not.toHaveBeenCalled();
- async.done();
- });
- }));
- });
-}
-
-@Component({selector: 'user-cmp', template: 'hello {{user}}'})
-class UserCmp {
- user: string;
- constructor(params: RouteParams) { this.user = params.get('name'); }
-}
-
-@Component({
- selector: 'test-component',
- template: `
- `,
- directives: [RouterLink]
-})
-class TestComponent {
-}
-
-function makeDummyLocation() {
- var dl = new SpyLocation();
- dl.spy('prepareExternalUrl').andCallFake((url: any /** TODO #9100 */) => url);
- return dl;
-}
-
-function makeDummyRouter() {
- var dr = new SpyRouter();
- dr.spy('generate').andCallFake((routeParams: any /** TODO #9100 */) => dummyInstruction);
- dr.spy('isRouteActive').andCallFake((_: any /** TODO #9100 */) => false);
- dr.spy('navigateInstruction');
- return dr;
-}
diff --git a/modules/@angular/router-deprecated/test/integration/README.md b/modules/@angular/router-deprecated/test/integration/README.md
deleted file mode 100644
index 157d7423d2..0000000000
--- a/modules/@angular/router-deprecated/test/integration/README.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# Router integration tests
-
-These tests only mock out `Location`, and otherwise use all the real parts of routing to ensure that
-various routing scenarios work as expected.
-
-The Component Router in Angular 2 exposes only a handful of different options, but because they can
-be combined and nested in so many ways, it's difficult to rigorously test all the cases.
-
-The address this problem, we introduce `describeRouter`, `describeWith`, and `describeWithout`.
\ No newline at end of file
diff --git a/modules/@angular/router-deprecated/test/integration/async_route_spec.ts b/modules/@angular/router-deprecated/test/integration/async_route_spec.ts
deleted file mode 100644
index 1098678286..0000000000
--- a/modules/@angular/router-deprecated/test/integration/async_route_spec.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {beforeEachProviders, describe} from '@angular/core/testing/testing_internal';
-
-import {registerSpecs} from './impl/async_route_spec_impl';
-import {TEST_ROUTER_PROVIDERS, ddescribeRouter, describeRouter, describeWith, describeWithAndWithout, describeWithout, itShouldRoute} from './util';
-
-export function main() {
- describe('async route spec', () => {
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- registerSpecs();
-
- describeRouter('async routes', () => {
- describeWithout('children', () => {
- describeWith('route data', itShouldRoute);
- describeWithAndWithout('params', itShouldRoute);
- });
-
- describeWith(
- 'sync children', () => { describeWithAndWithout('default routes', itShouldRoute); });
-
- describeWith('async children', () => {
- describeWithAndWithout(
- 'params', () => { describeWithout('default routes', itShouldRoute); });
- });
- });
- });
-}
diff --git a/modules/@angular/router-deprecated/test/integration/auxiliary_route_spec.ts b/modules/@angular/router-deprecated/test/integration/auxiliary_route_spec.ts
deleted file mode 100644
index 6882c6133e..0000000000
--- a/modules/@angular/router-deprecated/test/integration/auxiliary_route_spec.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {beforeEachProviders, describe} from '@angular/core/testing/testing_internal';
-
-import {registerSpecs} from './impl/aux_route_spec_impl';
-import {TEST_ROUTER_PROVIDERS, ddescribeRouter, describeRouter, describeWith, describeWithAndWithout, describeWithout, itShouldRoute} from './util';
-
-export function main() {
- describe('auxiliary route spec', () => {
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- registerSpecs();
-
- describeRouter('aux routes', () => {
- itShouldRoute();
- describeWith('a primary route', itShouldRoute);
- });
- });
-}
diff --git a/modules/@angular/router-deprecated/test/integration/bootstrap_spec.ts b/modules/@angular/router-deprecated/test/integration/bootstrap_spec.ts
deleted file mode 100644
index 68b011bfdd..0000000000
--- a/modules/@angular/router-deprecated/test/integration/bootstrap_spec.ts
+++ /dev/null
@@ -1,347 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {APP_BASE_HREF, LocationStrategy} from '@angular/common';
-import {MockLocationStrategy} from '@angular/common/testing/mock_location_strategy';
-import {disposePlatform} from '@angular/core';
-import {ApplicationRef} from '@angular/core/src/application_ref';
-import {Console} from '@angular/core/src/console';
-import {Component} from '@angular/core/src/metadata';
-import {TestComponentBuilder} from '@angular/core/testing';
-import {AsyncTestCompleter, MockApplicationRef, beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
-import {bootstrap} from '@angular/platform-browser-dynamic';
-import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
-import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
-import {expect} from '@angular/platform-browser/testing/matchers';
-import {ROUTER_DIRECTIVES, ROUTER_PRIMARY_COMPONENT, ROUTER_PROVIDERS, RouteParams, Router} from '@angular/router-deprecated';
-import {BaseException} from '../../src/facade/exceptions';
-import {AuxRoute, Route, RouteConfig} from '../../src/route_config/route_config_decorator';
-
-
-
-// noinspection JSAnnotator
-class DummyConsole implements Console {
- log(message: any /** TODO #9100 */) {}
- warn(message: any /** TODO #9100 */) {}
-}
-
-export function main() {
- describe('router bootstrap', () => {
- beforeEachProviders(
- () => [ROUTER_PROVIDERS, {provide: LocationStrategy, useClass: MockLocationStrategy}, {
- provide: ApplicationRef,
- useClass: MockApplicationRef
- }]);
-
- beforeEach(() => disposePlatform());
- afterEach(() => disposePlatform());
-
- // do not refactor out the `bootstrap` functionality. We still want to
- // keep this test around so we can ensure that bootstrap a router works
- it('should bootstrap a simple app',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- var fakeDoc = getDOM().createHtmlDocument();
- var el = getDOM().createElement('app-cmp', fakeDoc);
- getDOM().appendChild(fakeDoc.body, el);
-
- bootstrap(AppCmp, [
- ROUTER_PROVIDERS, {provide: ROUTER_PRIMARY_COMPONENT, useValue: AppCmp},
- {provide: LocationStrategy, useClass: MockLocationStrategy},
- {provide: DOCUMENT, useValue: fakeDoc}, {provide: Console, useClass: DummyConsole}
- ]).then((applicationRef) => {
- var router = applicationRef.instance.router;
- router.subscribe((_: any /** TODO #9100 */) => {
- expect(el).toHaveText('outer [ hello ]');
- expect(applicationRef.instance.location.path()).toEqual('');
- async.done();
- });
- });
- }));
-
- describe('broken app', () => {
- beforeEachProviders(() => [{provide: ROUTER_PRIMARY_COMPONENT, useValue: BrokenAppCmp}]);
-
- it('should rethrow exceptions from component constructors',
- inject(
- [AsyncTestCompleter, TestComponentBuilder],
- (async: AsyncTestCompleter, tcb: TestComponentBuilder) => {
- tcb.createAsync(AppCmp).then((fixture) => {
- var router = fixture.debugElement.componentInstance.router;
- router.navigateByUrl('/cause-error').catch((error: any) => {
- expect(error).toContainError('oops!');
- async.done();
- });
- });
- }));
- });
-
- describe('back button app', () => {
- beforeEachProviders(() => [{provide: ROUTER_PRIMARY_COMPONENT, useValue: HierarchyAppCmp}]);
-
- it('should change the url without pushing a new history state for back navigations',
- inject(
- [AsyncTestCompleter, TestComponentBuilder],
- (async: AsyncTestCompleter, tcb: TestComponentBuilder) => {
-
- tcb.createAsync(HierarchyAppCmp).then((fixture) => {
- var router = fixture.debugElement.componentInstance.router;
- var position = 0;
- var flipped = false;
- var history = [
- ['/parent/child', 'root [ parent [ hello ] ]', '/super-parent/child'],
- ['/super-parent/child', 'root [ super-parent [ hello2 ] ]', '/parent/child'],
- ['/parent/child', 'root [ parent [ hello ] ]', false]
- ];
-
- router.subscribe((_: any /** TODO #9100 */) => {
- var location = fixture.debugElement.componentInstance.location;
- var element = fixture.debugElement.nativeElement;
- var path = location.path();
-
- var entry = history[position];
-
- expect(path).toEqual(entry[0]);
- // expect(element).toHaveText(entry[1]);
-
- var nextUrl = entry[2];
- if (nextUrl == false) {
- flipped = true;
- }
-
- if (flipped && position == 0) {
- async.done();
- return;
- }
-
- position = position + (flipped ? -1 : 1);
- if (flipped) {
- location.back();
- } else {
- router.navigateByUrl(nextUrl);
- }
- });
-
- router.navigateByUrl(history[0][0]);
- });
- }),
- 1000);
- });
-
- describe('hierarchical app', () => {
- beforeEachProviders(
- () => { return [{provide: ROUTER_PRIMARY_COMPONENT, useValue: HierarchyAppCmp}]; });
-
- it('should bootstrap an app with a hierarchy',
- inject(
- [AsyncTestCompleter, TestComponentBuilder],
- (async: AsyncTestCompleter, tcb: TestComponentBuilder) => {
-
- tcb.createAsync(HierarchyAppCmp).then((fixture) => {
- var router = fixture.debugElement.componentInstance.router;
- router.subscribe((_: any /** TODO #9100 */) => {
- expect(fixture.debugElement.nativeElement)
- .toHaveText('root [ parent [ hello ] ]');
- expect(fixture.debugElement.componentInstance.location.path())
- .toEqual('/parent/child');
- async.done();
- });
- router.navigateByUrl('/parent/child');
- });
- }));
-
- // TODO(btford): mock out level lower than LocationStrategy once that level exists
- xdescribe('custom app base ref', () => {
- beforeEachProviders(() => { return [{provide: APP_BASE_HREF, useValue: '/my/app'}]; });
- it('should bootstrap',
- inject(
- [AsyncTestCompleter, TestComponentBuilder],
- (async: AsyncTestCompleter, tcb: TestComponentBuilder) => {
-
- tcb.createAsync(HierarchyAppCmp).then((fixture) => {
- var router = fixture.debugElement.componentInstance.router;
- router.subscribe((_: any /** TODO #9100 */) => {
- expect(fixture.debugElement.nativeElement)
- .toHaveText('root [ parent [ hello ] ]');
- expect(fixture.debugElement.componentInstance.location.path())
- .toEqual('/my/app/parent/child');
- async.done();
- });
- router.navigateByUrl('/parent/child');
- });
- }));
- });
- });
-
-
- describe('querystring params app', () => {
- beforeEachProviders(
- () => { return [{provide: ROUTER_PRIMARY_COMPONENT, useValue: QueryStringAppCmp}]; });
-
- it('should recognize and return querystring params with the injected RouteParams',
- inject(
- [AsyncTestCompleter, TestComponentBuilder],
- (async: AsyncTestCompleter, tcb: TestComponentBuilder) => {
- tcb.createAsync(QueryStringAppCmp).then((fixture) => {
- var router = fixture.debugElement.componentInstance.router;
- router.subscribe((_: any /** TODO #9100 */) => {
- fixture.detectChanges();
-
- expect(fixture.debugElement.nativeElement)
- .toHaveText('qParam = search-for-something');
- /*
- expect(applicationRef.hostComponent.location.path())
- .toEqual('/qs?q=search-for-something');*/
- async.done();
- });
- router.navigateByUrl('/qs?q=search-for-something');
- fixture.detectChanges();
- });
- }));
- });
-
- describe('activate event on outlet', () => {
- let tcb: TestComponentBuilder = null;
-
- beforeEachProviders(() => [{provide: ROUTER_PRIMARY_COMPONENT, useValue: AppCmp}]);
-
- beforeEach(inject([TestComponentBuilder], (testComponentBuilder: any /** TODO #9100 */) => {
- tcb = testComponentBuilder;
- }));
-
- it('should get a reference and pass data to components loaded inside of outlets',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- tcb.createAsync(AppWithOutletListeners).then(fixture => {
- let appInstance = fixture.debugElement.componentInstance;
- let router = appInstance.router;
-
- router.subscribe((_: any /** TODO #9100 */) => {
- fixture.detectChanges();
-
- expect(appInstance.helloCmp).toBeAnInstanceOf(HelloCmp);
- expect(appInstance.helloCmp.message).toBe('Ahoy');
-
- async.done();
- });
-
- // TODO(juliemr): This isn't necessary for the test to pass - figure
- // out what's going on.
- // router.navigateByUrl('/rainbow(pony)');
- });
- }));
- });
- });
-}
-
-
-@Component({selector: 'hello-cmp', template: 'hello'})
-class HelloCmp {
- public message: string;
-}
-
-@Component({selector: 'hello2-cmp', template: 'hello2'})
-class Hello2Cmp {
- public greeting: string;
-}
-
-@Component({
- selector: 'app-cmp',
- template: `outer [ ]`,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([new Route({path: '/', component: HelloCmp})])
-class AppCmp {
- constructor(public router: Router, public location: LocationStrategy) {}
-}
-
-@Component({
- selector: 'app-cmp',
- template: `
- Hello routing!
-
- `,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([
- new Route({path: '/rainbow', component: HelloCmp}),
- new AuxRoute({name: 'pony', path: 'pony', component: Hello2Cmp})
-])
-class AppWithOutletListeners {
- helloCmp: HelloCmp;
- hello2Cmp: Hello2Cmp;
-
- constructor(public router: Router, public location: LocationStrategy) {}
-
- activateHello(cmp: HelloCmp) {
- this.helloCmp = cmp;
- this.helloCmp.message = 'Ahoy';
- }
-
- activateHello2(cmp: Hello2Cmp) { this.hello2Cmp = cmp; }
-}
-
-@Component({
- selector: 'parent-cmp',
- template: `parent [ ]`,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([new Route({path: '/child', component: HelloCmp})])
-class ParentCmp {
-}
-
-@Component({
- selector: 'super-parent-cmp',
- template: `super-parent [ ]`,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([new Route({path: '/child', component: Hello2Cmp})])
-class SuperParentCmp {
-}
-
-@Component({
- selector: 'app-cmp',
- template: `root [ ]`,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([
- new Route({path: '/parent/...', component: ParentCmp}),
- new Route({path: '/super-parent/...', component: SuperParentCmp})
-])
-class HierarchyAppCmp {
- constructor(public router: Router, public location: LocationStrategy) {}
-}
-
-@Component({selector: 'qs-cmp', template: `qParam = {{q}}`})
-class QSCmp {
- q: string;
- constructor(params: RouteParams) { this.q = params.get('q'); }
-}
-
-@Component({
- selector: 'app-cmp',
- template: ` `,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([new Route({path: '/qs', component: QSCmp})])
-class QueryStringAppCmp {
- constructor(public router: Router, public location: LocationStrategy) {}
-}
-
-@Component({selector: 'oops-cmp', template: 'oh no'})
-class BrokenCmp {
- constructor() { throw new BaseException('oops!'); }
-}
-
-@Component({
- selector: 'app-cmp',
- template: `outer [ ]`,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([new Route({path: '/cause-error', component: BrokenCmp})])
-class BrokenAppCmp {
- constructor(public router: Router, public location: LocationStrategy) {}
-}
diff --git a/modules/@angular/router-deprecated/test/integration/impl/async_route_spec_impl.ts b/modules/@angular/router-deprecated/test/integration/impl/async_route_spec_impl.ts
deleted file mode 100644
index 4739987263..0000000000
--- a/modules/@angular/router-deprecated/test/integration/impl/async_route_spec_impl.ts
+++ /dev/null
@@ -1,677 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Location} from '@angular/common';
-import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing';
-import {AsyncTestCompleter, beforeEach, beforeEachProviders, iit, inject, it, xit} from '@angular/core/testing/testing_internal';
-import {expect} from '@angular/platform-browser/testing/matchers';
-import {AsyncRoute, Route, Router} from '@angular/router-deprecated';
-
-import {By} from '../../../../platform-browser/src/dom/debug/by';
-import {TEST_ROUTER_PROVIDERS, clickOnElement, compile, getHref, specs} from '../util';
-
-import {HelloCmp, ParentCmp, ParentWithDefaultCmp, TeamCmp, UserCmp, asyncDefaultParentCmpLoader, asyncParentCmpLoader, asyncRouteDataCmp, asyncTeamLoader, helloCmpLoader, parentCmpLoader, parentWithDefaultCmpLoader, userCmpLoader} from './fixture_components';
-
-function getLinkElement(rtc: ComponentFixture) {
- return rtc.debugElement.query(By.css('a')).nativeElement;
-}
-
-function asyncRoutesWithoutChildrenWithRouteData() {
- var fixture: any /** TODO #9100 */;
- var tcb: any /** TODO #9100 */;
- var rtr: any /** TODO #9100 */;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- }));
-
- it('should inject route data into the component',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/route-data', loader: asyncRouteDataCmp, data: {isAdmin: true}})]))
- .then((_) => rtr.navigateByUrl('/route-data'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('true');
- async.done();
- });
- }));
-
- it('should inject empty object if the route has no data property',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/route-data-default', loader: asyncRouteDataCmp})]))
- .then((_) => rtr.navigateByUrl('/route-data-default'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('');
- async.done();
- });
- }));
-}
-
-function asyncRoutesWithoutChildrenWithoutParams() {
- var fixture: any /** TODO #9100 */;
- var tcb: any /** TODO #9100 */;
- var rtr: any /** TODO #9100 */;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- }));
-
- it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/test', loader: helloCmpLoader, name: 'Hello'})]))
- .then((_) => rtr.navigateByUrl('/test'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('hello');
- async.done();
- });
- }));
-
- it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/test', loader: helloCmpLoader, name: 'Hello'})]))
- .then((_) => rtr.navigate(['/Hello']))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('hello');
- async.done();
- });
- }));
-
- it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `go to hello | `)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/test', loader: helloCmpLoader, name: 'Hello'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(getLinkElement(fixture))).toEqual('/test');
- async.done();
- });
- }));
-
- it('should navigate from a link click',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(
- tcb, `go to hello | `)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/test', loader: helloCmpLoader, name: 'Hello'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('go to hello | ');
-
- rtr.subscribe((_: any /** TODO #9100 */) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('go to hello | hello');
- expect(location.urlChanges).toEqual(['/test']);
- async.done();
- });
-
- clickOnElement(getLinkElement(fixture));
- });
- }));
-}
-
-
-function asyncRoutesWithoutChildrenWithParams() {
- var fixture: any /** TODO #9100 */;
- var tcb: any /** TODO #9100 */;
- var rtr: any /** TODO #9100 */;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- }));
-
- it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/user/:name', loader: userCmpLoader, name: 'User'})]))
- .then((_) => rtr.navigateByUrl('/user/igor'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('hello igor');
- async.done();
- });
- }));
-
- it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then(
- (_) =>
- rtr.config([new Route({path: '/user/:name', component: UserCmp, name: 'User'})]))
- .then((_) => rtr.navigate(['/User', {name: 'brian'}]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('hello brian');
- async.done();
- });
- }));
-
- it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(
- tcb,
- `greet naomi | `)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/user/:name', loader: userCmpLoader, name: 'User'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(getLinkElement(fixture))).toEqual('/user/naomi');
- async.done();
- });
- }));
-
- it('should navigate from a link click',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(
- tcb,
- `greet naomi | `)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/user/:name', loader: userCmpLoader, name: 'User'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('greet naomi | ');
-
- rtr.subscribe((_: any /** TODO #9100 */) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('greet naomi | hello naomi');
- expect(location.urlChanges).toEqual(['/user/naomi']);
- async.done();
- });
-
- clickOnElement(getLinkElement(fixture));
- });
- }));
-
- it('should navigate between components with different parameters',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/user/:name', loader: userCmpLoader, name: 'User'})]))
- .then((_) => rtr.navigateByUrl('/user/brian'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('hello brian');
- })
- .then((_) => rtr.navigateByUrl('/user/igor'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('hello igor');
- async.done();
- });
- }));
-}
-
-
-function asyncRoutesWithSyncChildrenWithoutDefaultRoutes() {
- var fixture: any /** TODO #9100 */;
- var tcb: any /** TODO #9100 */;
- var rtr: any /** TODO #9100 */;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- }));
-
- it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `outer [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/a/...', loader: parentCmpLoader, name: 'Parent'})]))
- .then((_) => rtr.navigateByUrl('/a/b'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('outer [ inner [ hello ] ]');
- async.done();
- });
- }));
-
- it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `outer [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/a/...', loader: parentCmpLoader, name: 'Parent'})]))
- .then((_) => rtr.navigate(['/Parent', 'Child']))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('outer [ inner [ hello ] ]');
- async.done();
- });
- }));
-
- it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(
- tcb,
- `nav to child | outer [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/a/...', loader: parentCmpLoader, name: 'Parent'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(getLinkElement(fixture))).toEqual('/a');
- async.done();
- });
- }));
-
- it('should navigate from a link click',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(
- tcb,
- `nav to child | outer [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/a/...', loader: parentCmpLoader, name: 'Parent'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('nav to child | outer [ ]');
-
- rtr.subscribe((_: any /** TODO #9100 */) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('nav to child | outer [ inner [ hello ] ]');
- expect(location.urlChanges).toEqual(['/a/b']);
- async.done();
- });
-
- clickOnElement(getLinkElement(fixture));
- });
- }));
-}
-
-
-function asyncRoutesWithSyncChildrenWithDefaultRoutes() {
- var fixture: any /** TODO #9100 */;
- var tcb: any /** TODO #9100 */;
- var rtr: any /** TODO #9100 */;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- }));
-
- it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `outer [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/a/...', loader: parentWithDefaultCmpLoader, name: 'Parent'})]))
- .then((_) => rtr.navigateByUrl('/a'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('outer [ inner [ hello ] ]');
- async.done();
- });
- }));
-
- it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `outer [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/a/...', loader: parentWithDefaultCmpLoader, name: 'Parent'})]))
- .then((_) => rtr.navigate(['/Parent']))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('outer [ inner [ hello ] ]');
- async.done();
- });
- }));
-
- it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(
- tcb,
- `link to inner | outer [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/a/...', loader: parentWithDefaultCmpLoader, name: 'Parent'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(getLinkElement(fixture))).toEqual('/a');
- async.done();
- });
- }));
-
- it('should navigate from a link click',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(
- tcb,
- `link to inner | outer [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/a/...', loader: parentWithDefaultCmpLoader, name: 'Parent'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('link to inner | outer [ ]');
-
- rtr.subscribe((_: any /** TODO #9100 */) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('link to inner | outer [ inner [ hello ] ]');
- expect(location.urlChanges).toEqual(['/a/b']);
- async.done();
- });
-
- clickOnElement(getLinkElement(fixture));
- });
- }));
-}
-
-
-function asyncRoutesWithAsyncChildrenWithoutParamsWithoutDefaultRoutes() {
- var rootTC: any /** TODO #9100 */;
- var tcb: any /** TODO #9100 */;
- var rtr: any /** TODO #9100 */;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- }));
-
- it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `outer [ ]`)
- .then((rtc) => { rootTC = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/a/...', loader: asyncParentCmpLoader, name: 'Parent'})]))
- .then((_) => rtr.navigateByUrl('/a/b'))
- .then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('outer [ inner [ hello ] ]');
- async.done();
- });
- }));
-
- it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `outer [ ]`)
- .then((rtc) => { rootTC = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/a/...', loader: asyncParentCmpLoader, name: 'Parent'})]))
- .then((_) => rtr.navigate(['/Parent', 'Child']))
- .then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('outer [ inner [ hello ] ]');
- async.done();
- });
- }));
-
- it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(
- tcb,
- `nav to child | outer [ ]`)
- .then((rtc) => { rootTC = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/a/...', loader: asyncParentCmpLoader, name: 'Parent'})]))
- .then((_) => {
- rootTC.detectChanges();
- expect(getHref(getLinkElement(rootTC))).toEqual('/a');
- async.done();
- });
- }));
-
- it('should navigate from a link click',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(
- tcb,
- `nav to child | outer [ ]`)
- .then((rtc) => { rootTC = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/a/...', loader: asyncParentCmpLoader, name: 'Parent'})]))
- .then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('nav to child | outer [ ]');
-
- rtr.subscribe((_: any /** TODO #9100 */) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement)
- .toHaveText('nav to child | outer [ inner [ hello ] ]');
- expect(location.urlChanges).toEqual(['/a/b']);
- async.done();
- });
-
- clickOnElement(getLinkElement(rootTC));
- });
- }));
-}
-
-
-function asyncRoutesWithAsyncChildrenWithoutParamsWithDefaultRoutes() {
- var rootTC: any /** TODO #9100 */;
- var tcb: any /** TODO #9100 */;
- var rtr: any /** TODO #9100 */;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- }));
-
- it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `outer [ ]`)
- .then((rtc) => { rootTC = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/a/...', loader: asyncDefaultParentCmpLoader, name: 'Parent'})]))
- .then((_) => rtr.navigateByUrl('/a'))
- .then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('outer [ inner [ hello ] ]');
- async.done();
- });
- }));
-
- it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `outer [ ]`)
- .then((rtc) => { rootTC = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/a/...', loader: asyncDefaultParentCmpLoader, name: 'Parent'})]))
- .then((_) => rtr.navigate(['/Parent']))
- .then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('outer [ inner [ hello ] ]');
- async.done();
- });
- }));
-
- it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(
- tcb,
- `nav to child | outer [ ]`)
- .then((rtc) => { rootTC = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/a/...', loader: asyncDefaultParentCmpLoader, name: 'Parent'})]))
- .then((_) => {
- rootTC.detectChanges();
- expect(getHref(getLinkElement(rootTC))).toEqual('/a');
- async.done();
- });
- }));
-
- it('should navigate from a link click',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(
- tcb,
- `nav to child | outer [ ]`)
- .then((rtc) => { rootTC = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/a/...', loader: asyncDefaultParentCmpLoader, name: 'Parent'})]))
- .then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('nav to child | outer [ ]');
-
- rtr.subscribe((_: any /** TODO #9100 */) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement)
- .toHaveText('nav to child | outer [ inner [ hello ] ]');
- expect(location.urlChanges).toEqual(['/a/b']);
- async.done();
- });
-
- clickOnElement(getLinkElement(rootTC));
- });
- }));
-}
-
-
-function asyncRoutesWithAsyncChildrenWithParamsWithoutDefaultRoutes() {
- var fixture: any /** TODO #9100 */;
- var tcb: any /** TODO #9100 */;
- var rtr: any /** TODO #9100 */;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- }));
-
- it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `[ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/team/:id/...', loader: asyncTeamLoader, name: 'Team'})]))
- .then((_) => rtr.navigateByUrl('/team/angular/user/matias'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('[ team angular | user [ hello matias ] ]');
- async.done();
- });
- }));
-
- it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `[ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/team/:id/...', loader: asyncTeamLoader, name: 'Team'})]))
- .then((_) => rtr.navigate(['/Team', {id: 'angular'}, 'User', {name: 'matias'}]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('[ team angular | user [ hello matias ] ]');
- async.done();
- });
- }));
-
- it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(
- tcb,
- `nav to matias [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/team/:id/...', loader: asyncTeamLoader, name: 'Team'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(getLinkElement(fixture))).toEqual('/team/angular');
- async.done();
- });
- }));
-
- it('should navigate from a link click',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(
- tcb,
- `nav to matias [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/team/:id/...', loader: asyncTeamLoader, name: 'Team'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('nav to matias [ ]');
-
- rtr.subscribe((_: any /** TODO #9100 */) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('nav to matias [ team angular | user [ hello matias ] ]');
- expect(location.urlChanges).toEqual(['/team/angular/user/matias']);
- async.done();
- });
-
- clickOnElement(getLinkElement(fixture));
- });
- }));
-}
-
-export function registerSpecs() {
- (specs as any /** TODO #9100 */)['asyncRoutesWithoutChildrenWithRouteData'] =
- asyncRoutesWithoutChildrenWithRouteData;
- (specs as any /** TODO #9100 */)['asyncRoutesWithoutChildrenWithoutParams'] =
- asyncRoutesWithoutChildrenWithoutParams;
- (specs as any /** TODO #9100 */)['asyncRoutesWithoutChildrenWithParams'] =
- asyncRoutesWithoutChildrenWithParams;
- (specs as any /** TODO #9100 */)['asyncRoutesWithSyncChildrenWithoutDefaultRoutes'] =
- asyncRoutesWithSyncChildrenWithoutDefaultRoutes;
- (specs as any /** TODO #9100 */)['asyncRoutesWithSyncChildrenWithDefaultRoutes'] =
- asyncRoutesWithSyncChildrenWithDefaultRoutes;
- (specs as
- any /** TODO #9100 */)['asyncRoutesWithAsyncChildrenWithoutParamsWithoutDefaultRoutes'] =
- asyncRoutesWithAsyncChildrenWithoutParamsWithoutDefaultRoutes;
- (specs as any /** TODO #9100 */)['asyncRoutesWithAsyncChildrenWithoutParamsWithDefaultRoutes'] =
- asyncRoutesWithAsyncChildrenWithoutParamsWithDefaultRoutes;
- (specs as any /** TODO #9100 */)['asyncRoutesWithAsyncChildrenWithParamsWithoutDefaultRoutes'] =
- asyncRoutesWithAsyncChildrenWithParamsWithoutDefaultRoutes;
-}
diff --git a/modules/@angular/router-deprecated/test/integration/impl/aux_route_spec_impl.ts b/modules/@angular/router-deprecated/test/integration/impl/aux_route_spec_impl.ts
deleted file mode 100644
index 96f55fd947..0000000000
--- a/modules/@angular/router-deprecated/test/integration/impl/aux_route_spec_impl.ts
+++ /dev/null
@@ -1,258 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Location} from '@angular/common';
-import {Component} from '@angular/core';
-import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing';
-import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
-import {By} from '@angular/platform-browser/src/dom/debug/by';
-import {expect} from '@angular/platform-browser/testing/matchers';
-import {AuxRoute, ROUTER_DIRECTIVES, Route, RouteConfig, Router} from '@angular/router-deprecated';
-
-import {BaseException} from '../../../src/facade/exceptions';
-import {clickOnElement, compile, getHref, specs} from '../util';
-
-function getLinkElement(rtc: ComponentFixture, linkIndex: number = 0) {
- return rtc.debugElement.queryAll(By.css('a'))[linkIndex].nativeElement;
-}
-
-function auxRoutes() {
- var tcb: TestComponentBuilder;
- var fixture: ComponentFixture;
- var rtr: any /** TODO #9100 */;
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- }));
-
- it('should recognize and navigate from the URL',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(
- tcb,
- `main [ ] | aux [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([
- new Route({path: '/hello', component: HelloCmp, name: 'Hello'}),
- new AuxRoute({path: '/modal', component: ModalCmp, name: 'Aux'})
- ]))
- .then((_) => rtr.navigateByUrl('/(modal)'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('main [] | aux [modal]');
- async.done();
- });
- }));
-
- it('should navigate via the link DSL',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(
- tcb,
- `main [ ] | aux [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([
- new Route({path: '/hello', component: HelloCmp, name: 'Hello'}),
- new AuxRoute({path: '/modal', component: ModalCmp, name: 'Modal'})
- ]))
- .then((_) => rtr.navigate(['/', ['Modal']]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('main [] | aux [modal]');
- async.done();
- });
- }));
-
- it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(
- tcb,
- `open modal | main [ ] | aux [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([
- new Route({path: '/hello', component: HelloCmp, name: 'Hello'}),
- new AuxRoute({path: '/modal', component: ModalCmp, name: 'Modal'})
- ]))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(getLinkElement(fixture))).toEqual('/(modal)');
- async.done();
- });
- }));
-
- it('should navigate from a link click',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(
- tcb,
- `open modal | hello | main [ ] | aux [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([
- new Route({path: '/hello', component: HelloCmp, name: 'Hello'}),
- new AuxRoute({path: '/modal', component: ModalCmp, name: 'Modal'})
- ]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('open modal | hello | main [] | aux []');
-
- var navCount = 0;
-
- rtr.subscribe((_: any /** TODO #9100 */) => {
- navCount += 1;
- fixture.detectChanges();
- if (navCount == 1) {
- expect(fixture.debugElement.nativeElement)
- .toHaveText('open modal | hello | main [] | aux [modal]');
- expect(location.urlChanges).toEqual(['/(modal)']);
- expect(getHref(getLinkElement(fixture, 0))).toEqual('/(modal)');
- expect(getHref(getLinkElement(fixture, 1))).toEqual('/hello(modal)');
-
- // click on primary route link
- clickOnElement(getLinkElement(fixture, 1));
- } else if (navCount == 2) {
- expect(fixture.debugElement.nativeElement)
- .toHaveText('open modal | hello | main [hello] | aux [modal]');
- expect(location.urlChanges).toEqual(['/(modal)', '/hello(modal)']);
- expect(getHref(getLinkElement(fixture, 0))).toEqual('/hello(modal)');
- expect(getHref(getLinkElement(fixture, 1))).toEqual('/hello(modal)');
- async.done();
- } else {
- throw new BaseException(`Unexpected route change #${navCount}`);
- }
- });
-
- clickOnElement(getLinkElement(fixture));
- });
- }));
-}
-
-
-function auxRoutesWithAPrimaryRoute() {
- var tcb: TestComponentBuilder;
- var fixture: ComponentFixture;
- var rtr: any /** TODO #9100 */;
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- }));
-
- it('should recognize and navigate from the URL',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(
- tcb,
- `main [ ] | aux [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([
- new Route({path: '/hello', component: HelloCmp, name: 'Hello'}),
- new AuxRoute({path: '/modal', component: ModalCmp, name: 'Aux'})
- ]))
- .then((_) => rtr.navigateByUrl('/hello(modal)'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('main [hello] | aux [modal]');
- async.done();
- });
- }));
-
- it('should navigate via the link DSL',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(
- tcb,
- `main [ ] | aux [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([
- new Route({path: '/hello', component: HelloCmp, name: 'Hello'}),
- new AuxRoute({path: '/modal', component: ModalCmp, name: 'Modal'})
- ]))
- .then((_) => rtr.navigate(['/Hello', ['Modal']]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('main [hello] | aux [modal]');
- async.done();
- });
- }));
-
- it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(
- tcb,
- `open modal | main [ ] | aux [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([
- new Route({path: '/hello', component: HelloCmp, name: 'Hello'}),
- new AuxRoute({path: '/modal', component: ModalCmp, name: 'Modal'})
- ]))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(getLinkElement(fixture))).toEqual('/hello(modal)');
- async.done();
- });
- }));
-
- it('should navigate from a link click',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(
- tcb,
- `open modal | main [ ] | aux [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([
- new Route({path: '/hello', component: HelloCmp, name: 'Hello'}),
- new AuxRoute({path: '/modal', component: ModalCmp, name: 'Modal'})
- ]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('open modal | main [] | aux []');
-
- rtr.subscribe((_: any /** TODO #9100 */) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('open modal | main [hello] | aux [modal]');
- expect(location.urlChanges).toEqual(['/hello(modal)']);
- async.done();
- });
-
- clickOnElement(getLinkElement(fixture));
- });
- }));
-}
-
-export function registerSpecs() {
- (specs as any /** TODO #9100 */)['auxRoutes'] = auxRoutes;
- (specs as any /** TODO #9100 */)['auxRoutesWithAPrimaryRoute'] = auxRoutesWithAPrimaryRoute;
-}
-
-
-@Component({selector: 'hello-cmp', template: `{{greeting}}`})
-class HelloCmp {
- greeting: string;
- constructor() { this.greeting = 'hello'; }
-}
-
-@Component({selector: 'modal-cmp', template: `modal`})
-class ModalCmp {
-}
-
-@Component({
- selector: 'aux-cmp',
- template: 'main [ ] | ' +
- 'aux [ ]',
- directives: [ROUTER_DIRECTIVES],
-})
-@RouteConfig([
- new Route({path: '/hello', component: HelloCmp, name: 'Hello'}),
- new AuxRoute({path: '/modal', component: ModalCmp, name: 'Aux'})
-])
-class AuxCmp {
-}
diff --git a/modules/@angular/router-deprecated/test/integration/impl/fixture_components.ts b/modules/@angular/router-deprecated/test/integration/impl/fixture_components.ts
deleted file mode 100644
index db85815172..0000000000
--- a/modules/@angular/router-deprecated/test/integration/impl/fixture_components.ts
+++ /dev/null
@@ -1,168 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Component, ComponentRef, ViewChild, ViewContainerRef} from '@angular/core';
-import {DynamicComponentLoader} from '@angular/core/src/linker/dynamic_component_loader';
-import {AsyncRoute, ROUTER_DIRECTIVES, Redirect, Route, RouteConfig, RouteData, RouteParams} from '@angular/router-deprecated';
-import {isPresent} from '../../../src/facade/lang';
-
-@Component({selector: 'goodbye-cmp', template: `{{farewell}}`})
-export class GoodbyeCmp {
- farewell: string;
- constructor() { this.farewell = 'goodbye'; }
-}
-
-@Component({selector: 'hello-cmp', template: `{{greeting}}`})
-export class HelloCmp {
- greeting: string;
- constructor() { this.greeting = 'hello'; }
-}
-
-export function helloCmpLoader() {
- return Promise.resolve(HelloCmp);
-}
-
-
-@Component({selector: 'user-cmp', template: `hello {{user}}`})
-export class UserCmp {
- user: string;
- constructor(params: RouteParams) { this.user = params.get('name'); }
-}
-
-export function userCmpLoader() {
- return Promise.resolve(UserCmp);
-}
-
-
-@Component({
- selector: 'parent-cmp',
- template: `inner [ ]`,
- directives: [ROUTER_DIRECTIVES],
-})
-@RouteConfig([new Route({path: '/b', component: HelloCmp, name: 'Child'})])
-export class ParentCmp {
-}
-
-export function parentCmpLoader() {
- return Promise.resolve(ParentCmp);
-}
-
-
-@Component({
- selector: 'parent-cmp',
- template: `inner [ ]`,
- directives: [ROUTER_DIRECTIVES],
-})
-@RouteConfig([new AsyncRoute({path: '/b', loader: helloCmpLoader, name: 'Child'})])
-export class AsyncParentCmp {
-}
-
-export function asyncParentCmpLoader() {
- return Promise.resolve(AsyncParentCmp);
-}
-
-@Component({
- selector: 'parent-cmp',
- template: `inner [ ]`,
- directives: [ROUTER_DIRECTIVES],
-})
-@RouteConfig(
- [new AsyncRoute({path: '/b', loader: helloCmpLoader, name: 'Child', useAsDefault: true})])
-export class AsyncDefaultParentCmp {
-}
-
-export function asyncDefaultParentCmpLoader() {
- return Promise.resolve(AsyncDefaultParentCmp);
-}
-
-
-@Component({
- selector: 'parent-cmp',
- template: `inner [ ]`,
- directives: [ROUTER_DIRECTIVES],
-})
-@RouteConfig([new Route({path: '/b', component: HelloCmp, name: 'Child', useAsDefault: true})])
-export class ParentWithDefaultCmp {
-}
-
-export function parentWithDefaultCmpLoader() {
- return Promise.resolve(ParentWithDefaultCmp);
-}
-
-
-@Component({
- selector: 'team-cmp',
- template: `team {{id}} | user [ ]`,
- directives: [ROUTER_DIRECTIVES],
-})
-@RouteConfig([new Route({path: '/user/:name', component: UserCmp, name: 'User'})])
-export class TeamCmp {
- id: string;
- constructor(params: RouteParams) { this.id = params.get('id'); }
-}
-
-@Component({
- selector: 'team-cmp',
- template: `team {{id}} | user [ ]`,
- directives: [ROUTER_DIRECTIVES],
-})
-@RouteConfig([new AsyncRoute({path: '/user/:name', loader: userCmpLoader, name: 'User'})])
-export class AsyncTeamCmp {
- id: string;
- constructor(params: RouteParams) { this.id = params.get('id'); }
-}
-
-export function asyncTeamLoader() {
- return Promise.resolve(AsyncTeamCmp);
-}
-
-
-@Component({selector: 'data-cmp', template: `{{myData}}`})
-export class RouteDataCmp {
- myData: boolean;
- constructor(data: RouteData) { this.myData = data.get('isAdmin'); }
-}
-
-export function asyncRouteDataCmp() {
- return Promise.resolve(RouteDataCmp);
-}
-
-@Component({selector: 'redirect-to-parent-cmp', template: 'redirect-to-parent'})
-@RouteConfig([new Redirect({path: '/child-redirect', redirectTo: ['../HelloSib']})])
-export class RedirectToParentCmp {
-}
-
-
-@Component({selector: 'dynamic-loader-cmp', template: `[
]`})
-@RouteConfig([new Route({path: '/', component: HelloCmp})])
-export class DynamicLoaderCmp {
- private _componentRef: ComponentRef = null;
-
- @ViewChild('viewport', {read: ViewContainerRef}) viewport: ViewContainerRef;
-
- constructor(private _dynamicComponentLoader: DynamicComponentLoader) {}
-
- onSomeAction(): Promise {
- if (isPresent(this._componentRef)) {
- this._componentRef.destroy();
- this._componentRef = null;
- }
- return this._dynamicComponentLoader
- .loadNextToLocation(DynamicallyLoadedComponent, this.viewport)
- .then((cmp) => { this._componentRef = cmp; });
- }
-}
-
-
-@Component({
- selector: 'loaded-cmp',
- template: ' ',
- directives: [ROUTER_DIRECTIVES]
-})
-class DynamicallyLoadedComponent {
-}
diff --git a/modules/@angular/router-deprecated/test/integration/impl/sync_route_spec_impl.ts b/modules/@angular/router-deprecated/test/integration/impl/sync_route_spec_impl.ts
deleted file mode 100644
index 34aaab8510..0000000000
--- a/modules/@angular/router-deprecated/test/integration/impl/sync_route_spec_impl.ts
+++ /dev/null
@@ -1,523 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Location} from '@angular/common';
-import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing';
-import {AsyncTestCompleter, beforeEach, beforeEachProviders, iit, inject, it, xit} from '@angular/core/testing/testing_internal';
-import {By} from '@angular/platform-browser/src/dom/debug/by';
-import {expect} from '@angular/platform-browser/testing/matchers';
-import {Route, Router} from '@angular/router-deprecated';
-import {TEST_ROUTER_PROVIDERS, clickOnElement, compile, getHref, specs} from '../util';
-
-import {DynamicLoaderCmp, HelloCmp, ParentCmp, ParentWithDefaultCmp, TeamCmp, UserCmp} from './fixture_components';
-
-
-function getLinkElement(rtc: ComponentFixture) {
- return rtc.debugElement.query(By.css('a')).nativeElement;
-}
-
-function syncRoutesWithoutChildrenWithoutParams() {
- var fixture: any /** TODO #9100 */;
- var tcb: any /** TODO #9100 */;
- var rtr: any /** TODO #9100 */;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- }));
-
- it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then(
- (_) => rtr.config([new Route({path: '/test', component: HelloCmp, name: 'Hello'})]))
- .then((_) => rtr.navigateByUrl('/test'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('hello');
- async.done();
- });
- }));
-
- it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then(
- (_) => rtr.config([new Route({path: '/test', component: HelloCmp, name: 'Hello'})]))
- .then((_) => rtr.navigate(['/Hello']))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('hello');
- async.done();
- });
- }));
-
- it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `go to hello | `)
- .then((rtc) => { fixture = rtc; })
- .then(
- (_) => rtr.config([new Route({path: '/test', component: HelloCmp, name: 'Hello'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(getLinkElement(fixture))).toEqual('/test');
- async.done();
- });
- }));
-
- it('should navigate from a link click',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(
- tcb, `go to hello | `)
- .then((rtc) => { fixture = rtc; })
- .then(
- (_) =>
- rtr.config([new Route({path: '/test', component: HelloCmp, name: 'Hello'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('go to hello | ');
-
- rtr.subscribe((_: any /** TODO #9100 */) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('go to hello | hello');
- expect(location.urlChanges).toEqual(['/test']);
- async.done();
- });
-
- clickOnElement(getLinkElement(fixture));
- });
- }));
-}
-
-
-function syncRoutesWithoutChildrenWithParams() {
- var fixture: any /** TODO #9100 */;
- var tcb: any /** TODO #9100 */;
- var rtr: any /** TODO #9100 */;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- }));
-
- it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then(
- (_) =>
- rtr.config([new Route({path: '/user/:name', component: UserCmp, name: 'User'})]))
- .then((_) => rtr.navigateByUrl('/user/igor'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('hello igor');
- async.done();
- });
- }));
-
- it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then(
- (_) =>
- rtr.config([new Route({path: '/user/:name', component: UserCmp, name: 'User'})]))
- .then((_) => rtr.navigate(['/User', {name: 'brian'}]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('hello brian');
- async.done();
- });
- }));
-
- it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(
- tcb,
- `greet naomi | `)
- .then((rtc) => { fixture = rtc; })
- .then(
- (_) =>
- rtr.config([new Route({path: '/user/:name', component: UserCmp, name: 'User'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(getLinkElement(fixture))).toEqual('/user/naomi');
- async.done();
- });
- }));
-
- it('should navigate from a link click',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(
- tcb,
- `greet naomi | `)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route(
- {path: '/user/:name', component: UserCmp, name: 'User'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('greet naomi | ');
-
- rtr.subscribe((_: any /** TODO #9100 */) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('greet naomi | hello naomi');
- expect(location.urlChanges).toEqual(['/user/naomi']);
- async.done();
- });
-
- clickOnElement(getLinkElement(fixture));
- });
- }));
-
- it('should navigate between components with different parameters',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then(
- (_) =>
- rtr.config([new Route({path: '/user/:name', component: UserCmp, name: 'User'})]))
- .then((_) => rtr.navigateByUrl('/user/brian'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('hello brian');
- })
- .then((_) => rtr.navigateByUrl('/user/igor'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('hello igor');
- async.done();
- });
- }));
-}
-
-
-function syncRoutesWithSyncChildrenWithoutDefaultRoutesWithoutParams() {
- var fixture: any /** TODO #9100 */;
- var tcb: any /** TODO #9100 */;
- var rtr: any /** TODO #9100 */;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- }));
-
- it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `outer [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then(
- (_) =>
- rtr.config([new Route({path: '/a/...', component: ParentCmp, name: 'Parent'})]))
- .then((_) => rtr.navigateByUrl('/a/b'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('outer [ inner [ hello ] ]');
- async.done();
- });
- }));
-
- it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `outer [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then(
- (_) =>
- rtr.config([new Route({path: '/a/...', component: ParentCmp, name: 'Parent'})]))
- .then((_) => rtr.navigate(['/Parent', 'Child']))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('outer [ inner [ hello ] ]');
- async.done();
- });
- }));
-
- it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(
- tcb,
- `nav to child | outer [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then(
- (_) =>
- rtr.config([new Route({path: '/a/...', component: ParentCmp, name: 'Parent'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(getLinkElement(fixture))).toEqual('/a/b');
- async.done();
- });
- }));
-
- it('should navigate from a link click',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(
- tcb,
- `nav to child | outer [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route(
- {path: '/a/...', component: ParentCmp, name: 'Parent'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('nav to child | outer [ ]');
-
- rtr.subscribe((_: any /** TODO #9100 */) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('nav to child | outer [ inner [ hello ] ]');
- expect(location.urlChanges).toEqual(['/a/b']);
- async.done();
- });
-
- clickOnElement(getLinkElement(fixture));
- });
- }));
-}
-
-
-function syncRoutesWithSyncChildrenWithoutDefaultRoutesWithParams() {
- var fixture: any /** TODO #9100 */;
- var tcb: any /** TODO #9100 */;
- var rtr: any /** TODO #9100 */;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- }));
-
- it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `[ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route(
- {path: '/team/:id/...', component: TeamCmp, name: 'Team'})]))
- .then((_) => rtr.navigateByUrl('/team/angular/user/matias'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('[ team angular | user [ hello matias ] ]');
- async.done();
- });
- }));
-
- it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `[ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route(
- {path: '/team/:id/...', component: TeamCmp, name: 'Team'})]))
- .then((_) => rtr.navigate(['/Team', {id: 'angular'}, 'User', {name: 'matias'}]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('[ team angular | user [ hello matias ] ]');
- async.done();
- });
- }));
-
- it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(
- tcb,
- `nav to matias [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route(
- {path: '/team/:id/...', component: TeamCmp, name: 'Team'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(getLinkElement(fixture))).toEqual('/team/angular/user/matias');
- async.done();
- });
- }));
-
- it('should navigate from a link click',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(
- tcb,
- `nav to matias [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route(
- {path: '/team/:id/...', component: TeamCmp, name: 'Team'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('nav to matias [ ]');
-
- rtr.subscribe((_: any /** TODO #9100 */) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('nav to matias [ team angular | user [ hello matias ] ]');
- expect(location.urlChanges).toEqual(['/team/angular/user/matias']);
- async.done();
- });
-
- clickOnElement(getLinkElement(fixture));
- });
- }));
-}
-
-
-function syncRoutesWithSyncChildrenWithDefaultRoutesWithoutParams() {
- var fixture: any /** TODO #9100 */;
- var tcb: any /** TODO #9100 */;
- var rtr: any /** TODO #9100 */;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- }));
-
- it('should navigate by URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `outer [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route(
- {path: '/a/...', component: ParentWithDefaultCmp, name: 'Parent'})]))
- .then((_) => rtr.navigateByUrl('/a'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('outer [ inner [ hello ] ]');
- async.done();
- });
- }));
-
- it('should navigate by link DSL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, `outer [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route(
- {path: '/a/...', component: ParentWithDefaultCmp, name: 'Parent'})]))
- .then((_) => rtr.navigate(['/Parent']))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('outer [ inner [ hello ] ]');
- async.done();
- });
- }));
-
- it('should generate a link URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(
- tcb,
- `link to inner | outer [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route(
- {path: '/a/...', component: ParentWithDefaultCmp, name: 'Parent'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(getLinkElement(fixture))).toEqual('/a');
- async.done();
- });
- }));
-
- it('should navigate from a link click',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(
- tcb,
- `link to inner | outer [ ]`)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route(
- {path: '/a/...', component: ParentWithDefaultCmp, name: 'Parent'})]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('link to inner | outer [ ]');
-
- rtr.subscribe((_: any /** TODO #9100 */) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('link to inner | outer [ inner [ hello ] ]');
- expect(location.urlChanges).toEqual(['/a/b']);
- async.done();
- });
-
- clickOnElement(getLinkElement(fixture));
- });
- }));
-}
-
-function syncRoutesWithDynamicComponents() {
- var fixture: ComponentFixture;
- var tcb: TestComponentBuilder;
- var rtr: Router;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- }));
-
-
- it('should work', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- tcb.createAsync(DynamicLoaderCmp)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/', component: HelloCmp})]))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('[ ]');
- return fixture.componentInstance.onSomeAction();
- })
- .then((_) => {
- fixture.detectChanges();
- return rtr.navigateByUrl('/');
- })
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('[ hello ]');
-
- return fixture.componentInstance.onSomeAction();
- })
- .then((_) => {
-
- // TODO(i): This should be rewritten to use NgZone#onStable or
- // something
- // similar basically the assertion needs to run when the world is
- // stable and we don't know when that is, only zones know.
- Promise.resolve(null).then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('[ hello ]');
- async.done();
- });
- });
- }));
-}
-
-
-
-export function registerSpecs() {
- (specs as any /** TODO #9100 */)['syncRoutesWithoutChildrenWithoutParams'] =
- syncRoutesWithoutChildrenWithoutParams;
- (specs as any /** TODO #9100 */)['syncRoutesWithoutChildrenWithParams'] =
- syncRoutesWithoutChildrenWithParams;
- (specs as any /** TODO #9100 */)['syncRoutesWithSyncChildrenWithoutDefaultRoutesWithoutParams'] =
- syncRoutesWithSyncChildrenWithoutDefaultRoutesWithoutParams;
- (specs as any /** TODO #9100 */)['syncRoutesWithSyncChildrenWithoutDefaultRoutesWithParams'] =
- syncRoutesWithSyncChildrenWithoutDefaultRoutesWithParams;
- (specs as any /** TODO #9100 */)['syncRoutesWithSyncChildrenWithDefaultRoutesWithoutParams'] =
- syncRoutesWithSyncChildrenWithDefaultRoutesWithoutParams;
- (specs as any /** TODO #9100 */)['syncRoutesWithDynamicComponents'] =
- syncRoutesWithDynamicComponents;
-}
diff --git a/modules/@angular/router-deprecated/test/integration/lifecycle_hook_spec.ts b/modules/@angular/router-deprecated/test/integration/lifecycle_hook_spec.ts
deleted file mode 100644
index 0fceb1754a..0000000000
--- a/modules/@angular/router-deprecated/test/integration/lifecycle_hook_spec.ts
+++ /dev/null
@@ -1,617 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Component} from '@angular/core';
-import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing';
-import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
-import {expect} from '@angular/platform-browser/testing/matchers';
-import {RouteParams, Router, RouterLink, RouterOutlet} from '@angular/router-deprecated';
-
-import {EventEmitter} from '../../src/facade/async';
-import {isPresent} from '../../src/facade/lang';
-import {ComponentInstruction} from '../../src/instruction';
-import {CanDeactivate, CanReuse, OnActivate, OnDeactivate, OnReuse} from '../../src/interfaces';
-import {CanActivate} from '../../src/lifecycle/lifecycle_annotations';
-import {AsyncRoute, AuxRoute, Redirect, Route, RouteConfig} from '../../src/route_config/route_config_decorator';
-
-import {TEST_ROUTER_PROVIDERS, compile} from './util';
-
-var cmpInstanceCount: any /** TODO #9100 */;
-var log: string[];
-var eventBus: EventEmitter;
-var resolve: (result: any) => void;
-var reject: (error: any) => void;
-var promise: Promise;
-
-export function main() {
- describe('Router lifecycle hooks', () => {
-
- var tcb: TestComponentBuilder;
- var fixture: ComponentFixture;
- var rtr: Router;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router], (tcBuilder: TestComponentBuilder, router: Router) => {
- tcb = tcBuilder;
- rtr = router;
- cmpInstanceCount = 0;
- log = [];
- eventBus = new EventEmitter();
- }));
-
- it('should call the routerOnActivate hook',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
- .then((_) => rtr.navigateByUrl('/on-activate'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('activate cmp');
- expect(log).toEqual(['activate: null -> /on-activate']);
- async.done();
- });
- }));
-
- it('should wait for a parent component\'s routerOnActivate hook to resolve before calling its child\'s',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
- .then((_) => {
- eventBus.subscribe({
- next: (ev: any) => {
- if (ev.startsWith('parent activate')) {
- resolve(true);
- }
- }
- });
- rtr.navigateByUrl('/parent-activate/child-activate').then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('parent [activate cmp]');
- expect(log).toEqual([
- 'parent activate: null -> /parent-activate', 'activate: null -> /child-activate'
- ]);
- async.done();
- });
- });
- }));
-
- it('should call the routerOnDeactivate hook',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
- .then((_) => rtr.navigateByUrl('/on-deactivate'))
- .then((_) => rtr.navigateByUrl('/a'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('A');
- expect(log).toEqual(['deactivate: /on-deactivate -> /a']);
- async.done();
- });
- }));
-
- it('should wait for a child component\'s routerOnDeactivate hook to resolve before calling its parent\'s',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
- .then((_) => rtr.navigateByUrl('/parent-deactivate/child-deactivate'))
- .then((_) => {
- eventBus.subscribe({
- next: (ev: any) => {
- if (ev.startsWith('deactivate')) {
- resolve(true);
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('parent [deactivate cmp]');
- }
- }
- });
- rtr.navigateByUrl('/a').then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('A');
- expect(log).toEqual([
- 'deactivate: /child-deactivate -> null',
- 'parent deactivate: /parent-deactivate -> /a'
- ]);
- async.done();
- });
- });
- }));
-
- it('should reuse a component when the routerCanReuse hook returns true',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
- .then((_) => rtr.navigateByUrl('/on-reuse/1/a'))
- .then((_) => {
- fixture.detectChanges();
- expect(log).toEqual([]);
- expect(fixture.debugElement.nativeElement).toHaveText('reuse [A]');
- expect(cmpInstanceCount).toBe(1);
- })
- .then((_) => rtr.navigateByUrl('/on-reuse/2/b'))
- .then((_) => {
- fixture.detectChanges();
- expect(log).toEqual(['reuse: /on-reuse/1 -> /on-reuse/2']);
- expect(fixture.debugElement.nativeElement).toHaveText('reuse [B]');
- expect(cmpInstanceCount).toBe(1);
- async.done();
- });
- }));
-
-
- it('should not reuse a component when the routerCanReuse hook returns false',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
- .then((_) => rtr.navigateByUrl('/never-reuse/1/a'))
- .then((_) => {
- fixture.detectChanges();
- expect(log).toEqual([]);
- expect(fixture.debugElement.nativeElement).toHaveText('reuse [A]');
- expect(cmpInstanceCount).toBe(1);
- })
- .then((_) => rtr.navigateByUrl('/never-reuse/2/b'))
- .then((_) => {
- fixture.detectChanges();
- expect(log).toEqual([]);
- expect(fixture.debugElement.nativeElement).toHaveText('reuse [B]');
- expect(cmpInstanceCount).toBe(2);
- async.done();
- });
- }));
-
-
- it('should navigate when routerCanActivate returns true',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
- .then((_) => {
- eventBus.subscribe({
- next: (ev: any) => {
- if (ev.startsWith('routerCanActivate')) {
- resolve(true);
- }
- }
- });
- rtr.navigateByUrl('/can-activate/a').then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('routerCanActivate [A]');
- expect(log).toEqual(['routerCanActivate: null -> /can-activate']);
- async.done();
- });
- });
- }));
-
- it('should not navigate when routerCanActivate returns false',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
- .then((_) => {
- eventBus.subscribe({
- next: (ev: any) => {
- if (ev.startsWith('routerCanActivate')) {
- resolve(false);
- }
- }
- });
- rtr.navigateByUrl('/can-activate/a').then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('');
- expect(log).toEqual(['routerCanActivate: null -> /can-activate']);
- async.done();
- });
- });
- }));
-
- it('should navigate away when routerCanDeactivate returns true',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
- .then((_) => rtr.navigateByUrl('/can-deactivate/a'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('routerCanDeactivate [A]');
- expect(log).toEqual([]);
-
- eventBus.subscribe({
- next: (ev: any) => {
- if (ev.startsWith('routerCanDeactivate')) {
- resolve(true);
- }
- }
- });
-
- rtr.navigateByUrl('/a').then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('A');
- expect(log).toEqual(['routerCanDeactivate: /can-deactivate -> /a']);
- async.done();
- });
- });
- }));
-
- it('should not navigate away when routerCanDeactivate returns false',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
- .then((_) => rtr.navigateByUrl('/can-deactivate/a'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('routerCanDeactivate [A]');
- expect(log).toEqual([]);
-
- eventBus.subscribe({
- next: (ev: any) => {
- if (ev.startsWith('routerCanDeactivate')) {
- resolve(false);
- }
- }
- });
-
- rtr.navigateByUrl('/a').then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('routerCanDeactivate [A]');
- expect(log).toEqual(['routerCanDeactivate: /can-deactivate -> /a']);
- async.done();
- });
- });
- }));
-
-
- it('should run activation and deactivation hooks in the correct order',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
- .then((_) => rtr.navigateByUrl('/activation-hooks/child'))
- .then((_) => {
- expect(log).toEqual([
- 'routerCanActivate child: null -> /child',
- 'routerCanActivate parent: null -> /activation-hooks',
- 'routerOnActivate parent: null -> /activation-hooks',
- 'routerOnActivate child: null -> /child'
- ]);
-
- log = [];
- return rtr.navigateByUrl('/a');
- })
- .then((_) => {
- expect(log).toEqual([
- 'routerCanDeactivate parent: /activation-hooks -> /a',
- 'routerCanDeactivate child: /child -> null',
- 'routerOnDeactivate child: /child -> null',
- 'routerOnDeactivate parent: /activation-hooks -> /a'
- ]);
- async.done();
- });
- }));
-
- it('should only run reuse hooks when reusing',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
- .then((_) => rtr.navigateByUrl('/reuse-hooks/1'))
- .then((_) => {
- expect(log).toEqual([
- 'routerCanActivate: null -> /reuse-hooks/1',
- 'routerOnActivate: null -> /reuse-hooks/1'
- ]);
-
- eventBus.subscribe({
- next: (ev: any) => {
- if (ev.startsWith('routerCanReuse')) {
- resolve(true);
- }
- }
- });
-
-
- log = [];
- return rtr.navigateByUrl('/reuse-hooks/2');
- })
- .then((_) => {
- expect(log).toEqual([
- 'routerCanReuse: /reuse-hooks/1 -> /reuse-hooks/2',
- 'routerOnReuse: /reuse-hooks/1 -> /reuse-hooks/2'
- ]);
- async.done();
- });
- }));
-
- it('should not run reuse hooks when not reusing',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((_) => rtr.config([new Route({path: '/...', component: LifecycleCmp})]))
- .then((_) => rtr.navigateByUrl('/reuse-hooks/1'))
- .then((_) => {
- expect(log).toEqual([
- 'routerCanActivate: null -> /reuse-hooks/1',
- 'routerOnActivate: null -> /reuse-hooks/1'
- ]);
-
- eventBus.subscribe({
- next: (ev: any) => {
- if (ev.startsWith('routerCanReuse')) {
- resolve(false);
- }
- }
- });
-
- log = [];
- return rtr.navigateByUrl('/reuse-hooks/2');
- })
- .then((_) => {
- expect(log).toEqual([
- 'routerCanReuse: /reuse-hooks/1 -> /reuse-hooks/2',
- 'routerCanActivate: /reuse-hooks/1 -> /reuse-hooks/2',
- 'routerCanDeactivate: /reuse-hooks/1 -> /reuse-hooks/2',
- 'routerOnDeactivate: /reuse-hooks/1 -> /reuse-hooks/2',
- 'routerOnActivate: /reuse-hooks/1 -> /reuse-hooks/2'
- ]);
- async.done();
- });
- }));
- });
-}
-
-
-@Component({selector: 'a-cmp', template: 'A'})
-class A {
-}
-
-
-@Component({selector: 'b-cmp', template: 'B'})
-class B {
-}
-
-
-function logHook(name: string, next: ComponentInstruction, prev: ComponentInstruction) {
- var message = name + ': ' + (isPresent(prev) ? ('/' + prev.urlPath) : 'null') + ' -> ' +
- (isPresent(next) ? ('/' + next.urlPath) : 'null');
- log.push(message);
- eventBus.emit(message);
-}
-
-@Component({selector: 'activate-cmp', template: 'activate cmp'})
-class ActivateCmp implements OnActivate {
- routerOnActivate(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('activate', next, prev);
- }
-}
-
-@Component({
- selector: 'parent-activate-cmp',
- template: `parent [ ]`,
- directives: [RouterOutlet]
-})
-@RouteConfig([new Route({path: '/child-activate', component: ActivateCmp})])
-class ParentActivateCmp implements OnActivate {
- routerOnActivate(next: ComponentInstruction, prev: ComponentInstruction): Promise {
- promise = new Promise((res, rej) => {
- resolve = res;
- reject = rej;
- });
- logHook('parent activate', next, prev);
- return promise;
- }
-}
-
-@Component({selector: 'deactivate-cmp', template: 'deactivate cmp'})
-class DeactivateCmp implements OnDeactivate {
- routerOnDeactivate(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('deactivate', next, prev);
- }
-}
-
-@Component({selector: 'deactivate-cmp', template: 'deactivate cmp'})
-class WaitDeactivateCmp implements OnDeactivate {
- routerOnDeactivate(next: ComponentInstruction, prev: ComponentInstruction): Promise {
- promise = new Promise((res, rej) => {
- resolve = res;
- reject = rej;
- });
- logHook('deactivate', next, prev);
- return promise;
- }
-}
-
-@Component({
- selector: 'parent-deactivate-cmp',
- template: `parent [ ]`,
- directives: [RouterOutlet]
-})
-@RouteConfig([new Route({path: '/child-deactivate', component: WaitDeactivateCmp})])
-class ParentDeactivateCmp implements OnDeactivate {
- routerOnDeactivate(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('parent deactivate', next, prev);
- }
-}
-
-@Component({
- selector: 'reuse-cmp',
- template: `reuse [ ]`,
- directives: [RouterOutlet]
-})
-@RouteConfig([new Route({path: '/a', component: A}), new Route({path: '/b', component: B})])
-class ReuseCmp implements OnReuse,
- CanReuse {
- constructor() { cmpInstanceCount += 1; }
- routerCanReuse(next: ComponentInstruction, prev: ComponentInstruction) { return true; }
- routerOnReuse(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('reuse', next, prev);
- }
-}
-
-@Component({
- selector: 'never-reuse-cmp',
- template: `reuse [ ]`,
- directives: [RouterOutlet]
-})
-@RouteConfig([new Route({path: '/a', component: A}), new Route({path: '/b', component: B})])
-class NeverReuseCmp implements OnReuse,
- CanReuse {
- constructor() { cmpInstanceCount += 1; }
- routerCanReuse(next: ComponentInstruction, prev: ComponentInstruction) { return false; }
- routerOnReuse(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('reuse', next, prev);
- }
-}
-
-@Component({
- selector: 'can-activate-cmp',
- template: `routerCanActivate [ ]`,
- directives: [RouterOutlet]
-})
-@RouteConfig([new Route({path: '/a', component: A}), new Route({path: '/b', component: B})])
-@CanActivate(CanActivateCmp.routerCanActivate)
-class CanActivateCmp {
- static routerCanActivate(next: ComponentInstruction, prev: ComponentInstruction):
- Promise {
- promise = new Promise((res, rej) => {
- resolve = res;
- reject = rej;
- });
- logHook('routerCanActivate', next, prev);
- return promise;
- }
-}
-
-@Component({
- selector: 'can-deactivate-cmp',
- template: `routerCanDeactivate [ ]`,
- directives: [RouterOutlet]
-})
-@RouteConfig([new Route({path: '/a', component: A}), new Route({path: '/b', component: B})])
-class CanDeactivateCmp implements CanDeactivate {
- routerCanDeactivate(next: ComponentInstruction, prev: ComponentInstruction): Promise {
- promise = new Promise((res, rej) => {
- resolve = res;
- reject = rej;
- });
- logHook('routerCanDeactivate', next, prev);
- return promise;
- }
-}
-
-@Component({selector: 'all-hooks-child-cmp', template: `child`})
-@CanActivate(AllHooksChildCmp.routerCanActivate)
-class AllHooksChildCmp implements CanDeactivate, OnDeactivate, OnActivate {
- routerCanDeactivate(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('routerCanDeactivate child', next, prev);
- return true;
- }
-
- routerOnDeactivate(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('routerOnDeactivate child', next, prev);
- }
-
- static routerCanActivate(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('routerCanActivate child', next, prev);
- return true;
- }
-
- routerOnActivate(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('routerOnActivate child', next, prev);
- }
-}
-
-@Component({
- selector: 'all-hooks-parent-cmp',
- template: ` `,
- directives: [RouterOutlet]
-})
-@RouteConfig([new Route({path: '/child', component: AllHooksChildCmp})])
-@CanActivate(AllHooksParentCmp.routerCanActivate)
-class AllHooksParentCmp implements CanDeactivate,
- OnDeactivate, OnActivate {
- routerCanDeactivate(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('routerCanDeactivate parent', next, prev);
- return true;
- }
-
- routerOnDeactivate(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('routerOnDeactivate parent', next, prev);
- }
-
- static routerCanActivate(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('routerCanActivate parent', next, prev);
- return true;
- }
-
- routerOnActivate(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('routerOnActivate parent', next, prev);
- }
-}
-
-@Component({selector: 'reuse-hooks-cmp', template: 'reuse hooks cmp'})
-@CanActivate(ReuseHooksCmp.routerCanActivate)
-class ReuseHooksCmp implements OnActivate, OnReuse, OnDeactivate, CanReuse, CanDeactivate {
- routerCanReuse(next: ComponentInstruction, prev: ComponentInstruction): Promise {
- promise = new Promise((res, rej) => {
- resolve = res;
- reject = rej;
- });
- logHook('routerCanReuse', next, prev);
- return promise;
- }
-
- routerOnReuse(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('routerOnReuse', next, prev);
- }
-
- routerCanDeactivate(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('routerCanDeactivate', next, prev);
- return true;
- }
-
- routerOnDeactivate(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('routerOnDeactivate', next, prev);
- }
-
- static routerCanActivate(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('routerCanActivate', next, prev);
- return true;
- }
-
- routerOnActivate(next: ComponentInstruction, prev: ComponentInstruction) {
- logHook('routerOnActivate', next, prev);
- }
-}
-
-@Component({
- selector: 'lifecycle-cmp',
- template: ` `,
- directives: [RouterOutlet]
-})
-@RouteConfig([
- new Route({path: '/a', component: A}), new Route({path: '/on-activate', component: ActivateCmp}),
- new Route({path: '/parent-activate/...', component: ParentActivateCmp}),
- new Route({path: '/on-deactivate', component: DeactivateCmp}),
- new Route({path: '/parent-deactivate/...', component: ParentDeactivateCmp}),
- new Route({path: '/on-reuse/:number/...', component: ReuseCmp}),
- new Route({path: '/never-reuse/:number/...', component: NeverReuseCmp}),
- new Route({path: '/can-activate/...', component: CanActivateCmp}),
- new Route({path: '/can-deactivate/...', component: CanDeactivateCmp}),
- new Route({path: '/activation-hooks/...', component: AllHooksParentCmp}),
- new Route({path: '/reuse-hooks/:number', component: ReuseHooksCmp})
-])
-class LifecycleCmp {
-}
diff --git a/modules/@angular/router-deprecated/test/integration/navigation_spec.ts b/modules/@angular/router-deprecated/test/integration/navigation_spec.ts
deleted file mode 100644
index 7df7f08da7..0000000000
--- a/modules/@angular/router-deprecated/test/integration/navigation_spec.ts
+++ /dev/null
@@ -1,307 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Location} from '@angular/common';
-import {Component, Inject, Injector, provide} from '@angular/core';
-import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing';
-import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
-import {expect} from '@angular/platform-browser/testing/matchers';
-import {RouteData, RouteParams, Router, RouterLink, RouterOutlet} from '@angular/router-deprecated';
-
-import {AsyncRoute, AuxRoute, Redirect, Route, RouteConfig} from '../../src/route_config/route_config_decorator';
-
-import {RootCmp, TEST_ROUTER_PROVIDERS, compile} from './util';
-
-var cmpInstanceCount: any /** TODO #9100 */;
-var childCmpInstanceCount: any /** TODO #9100 */;
-
-export function main() {
- describe('navigation', () => {
-
- var tcb: TestComponentBuilder;
- var fixture: ComponentFixture;
- var rtr: any /** TODO #9100 */;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- childCmpInstanceCount = 0;
- cmpInstanceCount = 0;
- }));
-
- it('should work in a simple case', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/test', component: HelloCmp})]))
- .then((_) => rtr.navigateByUrl('/test'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('hello');
- async.done();
- });
- }));
-
-
- it('should navigate between components with different parameters',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/user/:name', component: UserCmp})]))
- .then((_) => rtr.navigateByUrl('/user/brian'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('hello brian');
- })
- .then((_) => rtr.navigateByUrl('/user/igor'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('hello igor');
- async.done();
- });
- }));
-
- it('should navigate to child routes',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, 'outer [ ]')
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/a/...', component: ParentCmp})]))
- .then((_) => rtr.navigateByUrl('/a/b'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('outer [ inner [ hello ] ]');
- async.done();
- });
- }));
-
- it('should navigate to child routes that capture an empty path',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
-
- compile(tcb, 'outer [ ]')
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/a/...', component: ParentCmp})]))
- .then((_) => rtr.navigateByUrl('/a'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('outer [ inner [ hello ] ]');
- async.done();
- });
- }));
-
- it('should navigate to child routes when the root component has an empty path',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(tcb, 'outer [ ]')
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/...', component: ParentCmp})]))
- .then((_) => rtr.navigateByUrl('/b'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement)
- .toHaveText('outer [ inner [ hello ] ]');
- expect(location.urlChanges).toEqual(['/b']);
- async.done();
- });
- }));
-
- it('should navigate to child routes of async routes',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, 'outer [ ]')
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute({path: '/a/...', loader: parentLoader})]))
- .then((_) => rtr.navigateByUrl('/a/b'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('outer [ inner [ hello ] ]');
- async.done();
- });
- }));
-
-
- it('should replace state when normalized paths are equal',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => location.setInitialPath('/test/'))
- .then((_) => rtr.config([new Route({path: '/test', component: HelloCmp})]))
- .then((_) => rtr.navigateByUrl('/test'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('hello');
- expect(location.urlChanges).toEqual(['replace: /test']);
- async.done();
- });
- }));
-
- it('should reuse common parent components',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/team/:id/...', component: TeamCmp})]))
- .then((_) => rtr.navigateByUrl('/team/angular/user/rado'))
- .then((_) => {
- fixture.detectChanges();
- expect(cmpInstanceCount).toBe(1);
- expect(fixture.debugElement.nativeElement).toHaveText('team angular [ hello rado ]');
- })
- .then((_) => rtr.navigateByUrl('/team/angular/user/victor'))
- .then((_) => {
- fixture.detectChanges();
- expect(cmpInstanceCount).toBe(1);
- expect(fixture.debugElement.nativeElement)
- .toHaveText('team angular [ hello victor ]');
- async.done();
- });
- }));
-
- it('should not reuse children when parent components change',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/team/:id/...', component: TeamCmp})]))
- .then((_) => rtr.navigateByUrl('/team/angular/user/rado'))
- .then((_) => {
- fixture.detectChanges();
- expect(cmpInstanceCount).toBe(1);
- expect(childCmpInstanceCount).toBe(1);
- expect(fixture.debugElement.nativeElement).toHaveText('team angular [ hello rado ]');
- })
- .then((_) => rtr.navigateByUrl('/team/dart/user/rado'))
- .then((_) => {
- fixture.detectChanges();
- expect(cmpInstanceCount).toBe(2);
- expect(childCmpInstanceCount).toBe(2);
- expect(fixture.debugElement.nativeElement).toHaveText('team dart [ hello rado ]');
- async.done();
- });
- }));
-
- it('should inject route data into component',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route(
- {path: '/route-data', component: RouteDataCmp, data: {isAdmin: true}})]))
- .then((_) => rtr.navigateByUrl('/route-data'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('true');
- async.done();
- });
- }));
-
- it('should inject route data into component with AsyncRoute',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new AsyncRoute(
- {path: '/route-data', loader: asyncRouteDataCmp, data: {isAdmin: true}})]))
- .then((_) => rtr.navigateByUrl('/route-data'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('true');
- async.done();
- });
- }));
-
- it('should inject empty object if the route has no data property',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb)
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route(
- {path: '/route-data-default', component: RouteDataCmp})]))
- .then((_) => rtr.navigateByUrl('/route-data-default'))
- .then((_) => {
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('');
- async.done();
- });
- }));
-
- it('should fire an event for each activated component',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(tcb, ' ')
- .then((rtc) => { fixture = rtc; })
- .then((_) => rtr.config([new Route({path: '/test', component: HelloCmp})]))
- .then((_) => rtr.navigateByUrl('/test'))
- .then((_) => {
- // Note: need a timeout so that all promises are flushed
- return new Promise(resolve => { setTimeout(() => { resolve(null); }, 0); });
- })
- .then((_) => {
- expect(fixture.componentInstance.activatedCmp).toBeAnInstanceOf(HelloCmp);
- async.done();
- });
- }));
- });
-}
-
-
-@Component({selector: 'hello-cmp', template: `{{greeting}}`})
-class HelloCmp {
- greeting: string;
- constructor() { this.greeting = 'hello'; }
-}
-
-
-function asyncRouteDataCmp() {
- return Promise.resolve(RouteDataCmp);
-}
-
-@Component({selector: 'data-cmp', template: `{{myData}}`})
-class RouteDataCmp {
- myData: boolean;
- constructor(data: RouteData) { this.myData = data.get('isAdmin'); }
-}
-
-@Component({selector: 'user-cmp', template: `hello {{user}}`})
-class UserCmp {
- user: string;
- constructor(params: RouteParams) {
- childCmpInstanceCount += 1;
- this.user = params.get('name');
- }
-}
-
-
-function parentLoader() {
- return Promise.resolve(ParentCmp);
-}
-
-@Component({
- selector: 'parent-cmp',
- template: `inner [ ]`,
- directives: [RouterOutlet],
-})
-@RouteConfig([
- new Route({path: '/b', component: HelloCmp}),
- new Route({path: '/', component: HelloCmp}),
-])
-class ParentCmp {
-}
-
-
-@Component({
- selector: 'team-cmp',
- template: `team {{id}} [ ]`,
- directives: [RouterOutlet],
-})
-@RouteConfig([new Route({path: '/user/:name', component: UserCmp})])
-class TeamCmp {
- id: string;
- constructor(params: RouteParams) {
- this.id = params.get('id');
- cmpInstanceCount += 1;
- }
-}
diff --git a/modules/@angular/router-deprecated/test/integration/redirect_route_spec.ts b/modules/@angular/router-deprecated/test/integration/redirect_route_spec.ts
deleted file mode 100644
index 8c796dd429..0000000000
--- a/modules/@angular/router-deprecated/test/integration/redirect_route_spec.ts
+++ /dev/null
@@ -1,142 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Location} from '@angular/common';
-import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing';
-import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
-import {expect} from '@angular/platform-browser/testing/matchers';
-import {RouteData, RouteParams, Router, RouterLink, RouterOutlet} from '@angular/router-deprecated';
-
-import {AsyncRoute, AuxRoute, Redirect, Route, RouteConfig} from '../../src/route_config/route_config_decorator';
-
-import {GoodbyeCmp, HelloCmp, RedirectToParentCmp} from './impl/fixture_components';
-import {RootCmp, TEST_ROUTER_PROVIDERS, compile} from './util';
-
-var cmpInstanceCount: any /** TODO #9100 */;
-var childCmpInstanceCount: any /** TODO #9100 */;
-
-export function main() {
- describe('redirects', () => {
-
- var tcb: TestComponentBuilder;
- var rootTC: ComponentFixture;
- var rtr: any /** TODO #9100 */;
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- beforeEach(inject(
- [TestComponentBuilder, Router],
- (tcBuilder: any /** TODO #9100 */, router: any /** TODO #9100 */) => {
- tcb = tcBuilder;
- rtr = router;
- childCmpInstanceCount = 0;
- cmpInstanceCount = 0;
- }));
-
-
- it('should apply when navigating by URL',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(tcb)
- .then((rtc) => { rootTC = rtc; })
- .then((_) => rtr.config([
- new Redirect({path: '/original', redirectTo: ['Hello']}),
- new Route({path: '/redirected', component: HelloCmp, name: 'Hello'})
- ]))
- .then((_) => rtr.navigateByUrl('/original'))
- .then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('hello');
- expect(location.urlChanges).toEqual(['/redirected']);
- async.done();
- });
- }));
-
-
- it('should recognize and apply absolute redirects',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(tcb)
- .then((rtc) => { rootTC = rtc; })
- .then((_) => rtr.config([
- new Redirect({path: '/original', redirectTo: ['/Hello']}),
- new Route({path: '/redirected', component: HelloCmp, name: 'Hello'})
- ]))
- .then((_) => rtr.navigateByUrl('/original'))
- .then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('hello');
- expect(location.urlChanges).toEqual(['/redirected']);
- async.done();
- });
- }));
-
-
- it('should recognize and apply relative child redirects',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(tcb)
- .then((rtc) => { rootTC = rtc; })
- .then((_) => rtr.config([
- new Redirect({path: '/original', redirectTo: ['./Hello']}),
- new Route({path: '/redirected', component: HelloCmp, name: 'Hello'})
- ]))
- .then((_) => rtr.navigateByUrl('/original'))
- .then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('hello');
- expect(location.urlChanges).toEqual(['/redirected']);
- async.done();
- });
- }));
-
-
- it('should recognize and apply relative parent redirects',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(tcb)
- .then((rtc) => { rootTC = rtc; })
- .then((_) => rtr.config([
- new Route({path: '/original/...', component: RedirectToParentCmp}),
- new Route({path: '/redirected', component: HelloCmp, name: 'HelloSib'})
- ]))
- .then((_) => rtr.navigateByUrl('/original/child-redirect'))
- .then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('hello');
- expect(location.urlChanges).toEqual(['/redirected']);
- async.done();
- });
- }));
-
-
- it('should not redirect when redirect is less specific than other matching routes',
- inject(
- [AsyncTestCompleter, Location],
- (async: AsyncTestCompleter, location: any /** TODO #9100 */) => {
- compile(tcb)
- .then((rtc) => { rootTC = rtc; })
- .then((_) => rtr.config([
- new Route({path: '/foo', component: HelloCmp, name: 'Hello'}),
- new Route({path: '/:param', component: GoodbyeCmp, name: 'Goodbye'}),
- new Redirect({path: '/*rest', redirectTo: ['/Hello']})
- ]))
- .then((_) => rtr.navigateByUrl('/bye'))
- .then((_) => {
- rootTC.detectChanges();
- expect(rootTC.debugElement.nativeElement).toHaveText('goodbye');
- expect(location.urlChanges).toEqual(['/bye']);
- async.done();
- });
- }));
- });
-}
diff --git a/modules/@angular/router-deprecated/test/integration/router_link_spec.ts b/modules/@angular/router-deprecated/test/integration/router_link_spec.ts
deleted file mode 100644
index eb17437a9a..0000000000
--- a/modules/@angular/router-deprecated/test/integration/router_link_spec.ts
+++ /dev/null
@@ -1,501 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Location} from '@angular/common';
-import {SpyLocation} from '@angular/common/testing';
-import {Component} from '@angular/core';
-import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing';
-import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
-import {By} from '@angular/platform-browser/src/dom/debug/by';
-import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
-import {expect} from '@angular/platform-browser/testing/matchers';
-import {AsyncRoute, AuxRoute, ROUTER_DIRECTIVES, ROUTER_PRIMARY_COMPONENT, Route, RouteConfig, RouteParams, RouteRegistry, Router, RouterLink} from '@angular/router-deprecated';
-import {RootRouter} from '@angular/router-deprecated/src/router';
-import {ListWrapper} from '../../src/facade/collection';
-import {NumberWrapper, escapeRegExp} from '../../src/facade/lang';
-
-export function main() {
- describe('routerLink directive', function() {
- var tcb: TestComponentBuilder;
- var fixture: ComponentFixture;
- var router: Router;
- var location: Location;
-
- beforeEachProviders(
- () =>
- [RouteRegistry, {provide: Location, useClass: SpyLocation},
- {provide: ROUTER_PRIMARY_COMPONENT, useValue: MyComp7},
- {provide: Router, useClass: RootRouter},
- ]);
-
- beforeEach(inject(
- [TestComponentBuilder, Router, Location],
- (tcBuilder: TestComponentBuilder, rtr: Router, loc: Location) => {
- tcb = tcBuilder;
- router = rtr;
- location = loc;
- }));
-
- function compile(template: string = ' ') {
- return tcb.overrideTemplate(MyComp7, ('' + template + '
'))
- .createAsync(MyComp7)
- .then((tc) => { fixture = tc; });
- }
-
- it('should generate absolute hrefs that include the base href',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- (location).setBaseHref('/my/base');
- compile(' ')
- .then(
- (_) =>
- router.config([new Route({path: '/user', component: UserCmp, name: 'User'})]))
- .then((_) => router.navigateByUrl('/a/b'))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(fixture)).toEqual('/my/base/user');
- async.done();
- });
- }));
-
-
- it('should generate link hrefs without params',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(' ')
- .then(
- (_) =>
- router.config([new Route({path: '/user', component: UserCmp, name: 'User'})]))
- .then((_) => router.navigateByUrl('/a/b'))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(fixture)).toEqual('/user');
- async.done();
- });
- }));
-
-
- it('should generate link hrefs with params',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile('{{name}} ')
- .then((_) => router.config([new Route(
- {path: '/user/:name', component: UserCmp, name: 'User'})]))
- .then((_) => router.navigateByUrl('/a/b'))
- .then((_) => {
- fixture.debugElement.componentInstance.name = 'brian';
- fixture.detectChanges();
- expect(fixture.debugElement.nativeElement).toHaveText('brian');
- expect(getHref(fixture)).toEqual('/user/brian');
- async.done();
- });
- }));
-
- it('should generate link hrefs from a child to its sibling',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile()
- .then((_) => router.config([new Route(
- {path: '/page/:number', component: SiblingPageCmp, name: 'Page'})]))
- .then((_) => router.navigateByUrl('/page/1'))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(fixture)).toEqual('/page/2');
- async.done();
- });
- }));
-
- it('should generate link hrefs from a child to its sibling with no leading slash',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile()
- .then((_) => router.config([new Route(
- {path: '/page/:number', component: NoPrefixSiblingPageCmp, name: 'Page'})]))
- .then((_) => router.navigateByUrl('/page/1'))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(fixture)).toEqual('/page/2');
- async.done();
- });
- }));
-
- it('should generate link hrefs to a child with no leading slash',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile()
- .then((_) => router.config([new Route(
- {path: '/book/:title/...', component: NoPrefixBookCmp, name: 'Book'})]))
- .then((_) => router.navigateByUrl('/book/1984/page/1'))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(fixture)).toEqual('/book/1984/page/100');
- async.done();
- });
- }));
-
- it('should throw when links without a leading slash are ambiguous',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile()
- .then((_) => router.config([new Route(
- {path: '/book/:title/...', component: AmbiguousBookCmp, name: 'Book'})]))
- .then((_) => router.navigateByUrl('/book/1984/page/1'))
- .then((_) => {
- var link = ListWrapper.toJSON(['Book', {number: 100}]);
- expect(() => fixture.detectChanges())
- .toThrowError(new RegExp(escapeRegExp(
- `Link "${link}" is ambiguous, use "./" or "../" to disambiguate.`)));
- async.done();
- });
- }));
-
- it('should generate link hrefs when asynchronously loaded',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile()
- .then((_) => router.config([new AsyncRoute({
- path: '/child-with-grandchild/...',
- loader: parentCmpLoader,
- name: 'ChildWithGrandchild'
- })]))
- .then((_) => router.navigateByUrl('/child-with-grandchild/grandchild'))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(fixture)).toEqual('/child-with-grandchild/grandchild');
- async.done();
- });
- }));
-
- it('should generate relative links preserving the existing parent route',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile()
- .then((_) => router.config([new Route(
- {path: '/book/:title/...', component: BookCmp, name: 'Book'})]))
- .then((_) => router.navigateByUrl('/book/1984/page/1'))
- .then((_) => {
- fixture.detectChanges();
- // TODO(juliemr): This should be one By.css('book-cmp a') query, but the parse5
- // adapter
- // can't handle css child selectors.
- expect(getDOM().getAttribute(
- fixture.debugElement.query(By.css('book-cmp'))
- .query(By.css('a'))
- .nativeElement,
- 'href'))
- .toEqual('/book/1984/page/100');
-
- expect(getDOM().getAttribute(
- fixture.debugElement.query(By.css('page-cmp'))
- .query(By.css('a'))
- .nativeElement,
- 'href'))
- .toEqual('/book/1984/page/2');
- async.done();
- });
- }));
-
- it('should generate links to auxiliary routes',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile()
- .then((_) => router.config([new Route({path: '/...', component: AuxLinkCmp})]))
- .then((_) => router.navigateByUrl('/'))
- .then((_) => {
- fixture.detectChanges();
- expect(getHref(fixture)).toEqual('/(aside)');
- async.done();
- });
- }));
-
-
- describe('router-link-active CSS class', () => {
- it('should be added to the associated element',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- router
- .config([
- new Route({path: '/child', component: HelloCmp, name: 'Child'}),
- new Route({path: '/better-child', component: Hello2Cmp, name: 'BetterChild'})
- ])
- .then((_) => compile(`Child
- Better Child
- `))
- .then((_) => {
- var element = fixture.debugElement.nativeElement;
-
- fixture.detectChanges();
-
- var link1 = getDOM().querySelector(element, '.child-link');
- var link2 = getDOM().querySelector(element, '.better-child-link');
-
- expect(link1).not.toHaveCssClass('router-link-active');
- expect(link2).not.toHaveCssClass('router-link-active');
-
- router.subscribe((_) => {
- fixture.detectChanges();
-
- expect(link1).not.toHaveCssClass('router-link-active');
- expect(link2).toHaveCssClass('router-link-active');
-
- async.done();
- });
- router.navigateByUrl('/better-child?extra=0');
- });
- }));
-
- it('should be added to links in child routes',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- router
- .config([
- new Route({path: '/child', component: HelloCmp, name: 'Child'}), new Route({
- path: '/child-with-grandchild/...',
- component: ParentCmp,
- name: 'ChildWithGrandchild'
- })
- ])
- .then((_) => compile(`Child
- Better Child
- `))
- .then((_) => {
- var element = fixture.debugElement.nativeElement;
-
- fixture.detectChanges();
-
- var link1 = getDOM().querySelector(element, '.child-link');
- var link2 = getDOM().querySelector(element, '.child-with-grandchild-link');
-
- expect(link1).not.toHaveCssClass('router-link-active');
- expect(link2).not.toHaveCssClass('router-link-active');
-
- router.subscribe((_) => {
- fixture.detectChanges();
-
- expect(link1).not.toHaveCssClass('router-link-active');
- expect(link2).toHaveCssClass('router-link-active');
-
- var link3 = getDOM().querySelector(element, '.grandchild-link');
- var link4 = getDOM().querySelector(element, '.better-grandchild-link');
-
- expect(link3).toHaveCssClass('router-link-active');
- expect(link4).not.toHaveCssClass('router-link-active');
-
- async.done();
- });
- router.navigateByUrl('/child-with-grandchild/grandchild?extra=0');
- });
- }));
-
- it('should not be added to links in other child routes',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- router
- .config([
- new Route({path: '/child', component: HelloCmp, name: 'Child'}), new Route({
- path: '/child-with-grandchild/...',
- component: ParentCmp,
- name: 'ChildWithGrandchild'
- }),
- new Route({
- path: '/child-with-other-grandchild/...',
- component: ParentCmp,
- name: 'ChildWithOtherGrandchild'
- })
- ])
- .then((_) => compile(`Child
- Better Child
- Better Child
- `))
- .then((_) => {
- var element = fixture.debugElement.nativeElement;
-
- fixture.detectChanges();
-
- var link1 = getDOM().querySelector(element, '.child-link');
- var link2 = getDOM().querySelector(element, '.child-with-grandchild-link');
- var link3 = getDOM().querySelector(element, '.child-with-other-grandchild-link');
-
- expect(link1).not.toHaveCssClass('router-link-active');
- expect(link2).not.toHaveCssClass('router-link-active');
- expect(link3).not.toHaveCssClass('router-link-active');
-
- router.subscribe((_) => {
- fixture.detectChanges();
-
- expect(link1).not.toHaveCssClass('router-link-active');
- expect(link2).toHaveCssClass('router-link-active');
- expect(link3).not.toHaveCssClass('router-link-active');
-
- async.done();
- });
- router.navigateByUrl('/child-with-grandchild/grandchild?extra=0');
- });
- }));
- });
-
- describe('when clicked', () => {
-
- var clickOnElement = function(view: any /** TODO #9100 */) {
- var anchorEl = fixture.debugElement.query(By.css('a')).nativeElement;
- var dispatchedEvent = getDOM().createMouseEvent('click');
- getDOM().dispatchEvent(anchorEl, dispatchedEvent);
- return dispatchedEvent;
- };
-
- it('should navigate to link hrefs without params',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- compile(' ')
- .then((_) => router.config([new Route(
- {path: '/user', component: UserCmp, name: 'User'})]))
- .then((_) => router.navigateByUrl('/a/b'))
- .then((_) => {
- fixture.detectChanges();
-
- var dispatchedEvent = clickOnElement(fixture);
- expect(getDOM().isPrevented(dispatchedEvent)).toBe(true);
-
- // router navigation is async.
- router.subscribe((_) => {
- expect((location).urlChanges).toEqual(['/user']);
- async.done();
- });
- });
- }));
-
- it('should navigate to link hrefs in presence of base href',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- (location).setBaseHref('/base');
- compile(' ')
- .then((_) => router.config([new Route(
- {path: '/user', component: UserCmp, name: 'User'})]))
- .then((_) => router.navigateByUrl('/a/b'))
- .then((_) => {
- fixture.detectChanges();
-
-
- var dispatchedEvent = clickOnElement(fixture);
- expect(getDOM().isPrevented(dispatchedEvent)).toBe(true);
-
- // router navigation is async.
- router.subscribe((_) => {
- expect((location).urlChanges).toEqual(['/base/user']);
- async.done();
- });
- });
- }));
- });
- });
-}
-
-function getHref(tc: ComponentFixture) {
- return getDOM().getAttribute(tc.debugElement.query(By.css('a')).nativeElement, 'href');
-}
-
-@Component({selector: 'my-comp', template: '', directives: [ROUTER_DIRECTIVES]})
-class MyComp7 {
- name: any /** TODO #9100 */;
-}
-
-@Component({selector: 'user-cmp', template: 'hello {{user}}'})
-class UserCmp {
- user: string;
- constructor(params: RouteParams) { this.user = params.get('name'); }
-}
-
-@Component({
- selector: 'page-cmp',
- template:
- `page #{{pageNumber}} | next `,
- directives: [RouterLink]
-})
-class SiblingPageCmp {
- pageNumber: number;
- nextPage: number;
- constructor(params: RouteParams) {
- this.pageNumber = NumberWrapper.parseInt(params.get('number'), 10);
- this.nextPage = this.pageNumber + 1;
- }
-}
-
-@Component({
- selector: 'page-cmp',
- template:
- `page #{{pageNumber}} | next `,
- directives: [RouterLink]
-})
-class NoPrefixSiblingPageCmp {
- pageNumber: number;
- nextPage: number;
- constructor(params: RouteParams) {
- this.pageNumber = NumberWrapper.parseInt(params.get('number'), 10);
- this.nextPage = this.pageNumber + 1;
- }
-}
-
-@Component({selector: 'hello-cmp', template: 'hello'})
-class HelloCmp {
-}
-
-@Component({selector: 'hello2-cmp', template: 'hello2'})
-class Hello2Cmp {
-}
-
-function parentCmpLoader() {
- return Promise.resolve(ParentCmp);
-}
-
-@Component({
- selector: 'parent-cmp',
- template: `[ Grandchild
- Better Grandchild
- ]`,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([
- new Route({path: '/grandchild', component: HelloCmp, name: 'Grandchild'}),
- new Route({path: '/better-grandchild', component: Hello2Cmp, name: 'BetterGrandchild'})
-])
-class ParentCmp {
-}
-
-@Component({
- selector: 'book-cmp',
- template: `{{title}} |
- `,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([new Route({path: '/page/:number', component: SiblingPageCmp, name: 'Page'})])
-class BookCmp {
- title: string;
- constructor(params: RouteParams) { this.title = params.get('title'); }
-}
-
-@Component({
- selector: 'book-cmp',
- template: `{{title}} |
- `,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([new Route({path: '/page/:number', component: SiblingPageCmp, name: 'Page'})])
-class NoPrefixBookCmp {
- title: string;
- constructor(params: RouteParams) { this.title = params.get('title'); }
-}
-
-@Component({
- selector: 'book-cmp',
- template: `{{title}} |
- `,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([new Route({path: '/page/:number', component: SiblingPageCmp, name: 'Book'})])
-class AmbiguousBookCmp {
- title: string;
- constructor(params: RouteParams) { this.title = params.get('title'); }
-}
-
-@Component({
- selector: 'aux-cmp',
- template: `aside |
- | aside `,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([
- new Route({path: '/', component: HelloCmp, name: 'Hello'}),
- new AuxRoute({path: '/aside', component: Hello2Cmp, name: 'Aside'})
-])
-class AuxLinkCmp {
-}
diff --git a/modules/@angular/router-deprecated/test/integration/sync_route_spec.ts b/modules/@angular/router-deprecated/test/integration/sync_route_spec.ts
deleted file mode 100644
index 1425cceb4b..0000000000
--- a/modules/@angular/router-deprecated/test/integration/sync_route_spec.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {beforeEachProviders, ddescribe, describe} from '@angular/core/testing/testing_internal';
-
-import {registerSpecs} from './impl/sync_route_spec_impl';
-import {TEST_ROUTER_PROVIDERS, ddescribeRouter, describeRouter, describeWith, describeWithAndWithout, describeWithout, itShouldRoute} from './util';
-
-export function main() {
- describe('sync route spec', () => {
-
- beforeEachProviders(() => TEST_ROUTER_PROVIDERS);
-
- registerSpecs();
-
- describeRouter('sync routes', () => {
- describeWithout('children', () => { describeWithAndWithout('params', itShouldRoute); });
-
- describeWith('sync children', () => {
- describeWithout(
- 'default routes', () => { describeWithAndWithout('params', itShouldRoute); });
- describeWith('default routes', () => { describeWithout('params', itShouldRoute); });
-
- });
-
- describeWith('dynamic components', itShouldRoute);
- });
-
- });
-}
diff --git a/modules/@angular/router-deprecated/test/integration/util.ts b/modules/@angular/router-deprecated/test/integration/util.ts
deleted file mode 100644
index 3e092be28d..0000000000
--- a/modules/@angular/router-deprecated/test/integration/util.ts
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Location} from '@angular/common';
-import {SpyLocation} from '@angular/common/testing';
-import {Component, provide} from '@angular/core';
-import {ComponentFixture, TestComponentBuilder} from '@angular/core/testing';
-import {beforeEach, beforeEachProviders, ddescribe, describe, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
-import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
-import {ROUTER_DIRECTIVES, ROUTER_PRIMARY_COMPONENT, Router} from '@angular/router-deprecated';
-import {RouteRegistry} from '@angular/router-deprecated/src/route_registry';
-import {RootRouter} from '@angular/router-deprecated/src/router';
-
-import {BaseException} from '../../src/facade/exceptions';
-import {isBlank} from '../../src/facade/lang';
-
-
-/**
- * Router test helpers and fixtures
- */
-
-@Component({
- selector: 'root-comp',
- template: ` `,
- directives: [ROUTER_DIRECTIVES]
-})
-export class RootCmp {
- name: string;
- activatedCmp: any;
-}
-
-export function compile(
- tcb: TestComponentBuilder,
- template: string = ' '): Promise> {
- return tcb.overrideTemplate(RootCmp, ('' + template + '
')).createAsync(RootCmp);
-}
-
-export var TEST_ROUTER_PROVIDERS: any[] = [
- RouteRegistry, {provide: Location, useClass: SpyLocation},
- {provide: ROUTER_PRIMARY_COMPONENT, useValue: RootCmp}, {provide: Router, useClass: RootRouter}
-];
-
-export function clickOnElement(anchorEl: any /** TODO #9100 */) {
- var dispatchedEvent = getDOM().createMouseEvent('click');
- getDOM().dispatchEvent(anchorEl, dispatchedEvent);
- return dispatchedEvent;
-}
-
-export function getHref(elt: any /** TODO #9100 */) {
- return getDOM().getAttribute(elt, 'href');
-}
-
-
-/**
- * Router integration suite DSL
- */
-
-var specNameBuilder: any[] /** TODO #9100 */ = [];
-
-// we add the specs themselves onto this map
-export var specs = {};
-
-export function describeRouter(description: string, fn: Function, exclusive = false): void {
- var specName = descriptionToSpecName(description);
- specNameBuilder.push(specName);
- if (exclusive) {
- ddescribe(description, fn);
- } else {
- describe(description, fn);
- }
- specNameBuilder.pop();
-}
-
-export function ddescribeRouter(description: string, fn: Function, exclusive = false): void {
- describeRouter(description, fn, true);
-}
-
-export function describeWithAndWithout(description: string, fn: Function): void {
- // the "without" case is usually simpler, so we opt to run this spec first
- describeWithout(description, fn);
- describeWith(description, fn);
-}
-
-export function describeWith(description: string, fn: Function): void {
- var specName = 'with ' + description;
- specNameBuilder.push(specName);
- describe(specName, fn);
- specNameBuilder.pop();
-}
-
-export function describeWithout(description: string, fn: Function): void {
- var specName = 'without ' + description;
- specNameBuilder.push(specName);
- describe(specName, fn);
- specNameBuilder.pop();
-}
-
-function descriptionToSpecName(description: string): string {
- return spaceCaseToCamelCase(description);
-}
-
-// this helper looks up the suite registered from the "impl" folder in this directory
-export function itShouldRoute() {
- var specSuiteName = spaceCaseToCamelCase(specNameBuilder.join(' '));
-
- var spec = (specs as any /** TODO #9100 */)[specSuiteName];
- if (isBlank(spec)) {
- throw new BaseException(`Router integration spec suite "${specSuiteName}" was not found.`);
- } else {
- // todo: remove spec from map, throw if there are extra left over??
- spec();
- }
-}
-
-function spaceCaseToCamelCase(str: string): string {
- var words = str.split(' ');
- var first = words.shift();
- return first + words.map(title).join('');
-}
-
-function title(str: string): string {
- return str[0].toUpperCase() + str.substring(1);
-}
diff --git a/modules/@angular/router-deprecated/test/location/hash_location_strategy_spec.ts b/modules/@angular/router-deprecated/test/location/hash_location_strategy_spec.ts
deleted file mode 100644
index 45cb566864..0000000000
--- a/modules/@angular/router-deprecated/test/location/hash_location_strategy_spec.ts
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {APP_BASE_HREF, HashLocationStrategy, PlatformLocation} from '@angular/common';
-import {Injector, provide} from '@angular/core';
-import {beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it} from '@angular/core/testing/testing_internal';
-
-import {SpyPlatformLocation} from '../spies';
-
-export function main() {
- describe('HashLocationStrategy', () => {
- var platformLocation: SpyPlatformLocation;
- var locationStrategy: HashLocationStrategy;
-
- beforeEachProviders(
- () => [HashLocationStrategy, {provide: PlatformLocation, useClass: SpyPlatformLocation}]);
-
- describe('without APP_BASE_HREF', () => {
- beforeEach(inject(
- [PlatformLocation, HashLocationStrategy],
- (pl: any /** TODO #9100 */, ls: any /** TODO #9100 */) => {
- platformLocation = pl;
- locationStrategy = ls;
- platformLocation.spy('pushState');
- platformLocation.pathname = '';
- }));
-
- it('should prepend urls with a hash for non-empty URLs', () => {
- expect(locationStrategy.prepareExternalUrl('foo')).toEqual('#foo');
-
- locationStrategy.pushState(null, 'Title', 'foo', '');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', '#foo');
- });
-
- it('should prepend urls with a hash for URLs with query params', () => {
- expect(locationStrategy.prepareExternalUrl('foo?bar')).toEqual('#foo?bar');
-
- locationStrategy.pushState(null, 'Title', 'foo', 'bar=baz');
- expect(platformLocation.spy('pushState'))
- .toHaveBeenCalledWith(null, 'Title', '#foo?bar=baz');
- });
-
- it('should prepend urls with a hash for URLs with just query params', () => {
- expect(locationStrategy.prepareExternalUrl('?bar')).toEqual('#?bar');
-
- locationStrategy.pushState(null, 'Title', '', 'bar=baz');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', '#?bar=baz');
- });
-
- it('should not prepend a hash to external urls for an empty internal URL', () => {
- expect(locationStrategy.prepareExternalUrl('')).toEqual('');
-
- locationStrategy.pushState(null, 'Title', '', '');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', '');
- });
- });
-
- describe('with APP_BASE_HREF with neither leading nor trailing slash', () => {
- beforeEachProviders(() => [{provide: APP_BASE_HREF, useValue: 'app'}]);
-
- beforeEach(inject(
- [PlatformLocation, HashLocationStrategy],
- (pl: any /** TODO #9100 */, ls: any /** TODO #9100 */) => {
- platformLocation = pl;
- locationStrategy = ls;
- platformLocation.spy('pushState');
- platformLocation.pathname = '';
- }));
-
- it('should prepend urls with a hash for non-empty URLs', () => {
- expect(locationStrategy.prepareExternalUrl('foo')).toEqual('#app/foo');
-
- locationStrategy.pushState(null, 'Title', 'foo', '');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', '#app/foo');
- });
-
- it('should prepend urls with a hash for URLs with query params', () => {
- expect(locationStrategy.prepareExternalUrl('foo?bar')).toEqual('#app/foo?bar');
-
- locationStrategy.pushState(null, 'Title', 'foo', 'bar=baz');
- expect(platformLocation.spy('pushState'))
- .toHaveBeenCalledWith(null, 'Title', '#app/foo?bar=baz');
- });
-
- it('should not prepend a hash to external urls for an empty internal URL', () => {
- expect(locationStrategy.prepareExternalUrl('')).toEqual('#app');
-
- locationStrategy.pushState(null, 'Title', '', '');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', '#app');
- });
- });
-
- describe('with APP_BASE_HREF with leading slash', () => {
- beforeEachProviders(() => [{provide: APP_BASE_HREF, useValue: '/app'}]);
-
- beforeEach(inject(
- [PlatformLocation, HashLocationStrategy],
- (pl: any /** TODO #9100 */, ls: any /** TODO #9100 */) => {
- platformLocation = pl;
- locationStrategy = ls;
- platformLocation.spy('pushState');
- platformLocation.pathname = '';
- }));
-
- it('should prepend urls with a hash for non-empty URLs', () => {
- expect(locationStrategy.prepareExternalUrl('foo')).toEqual('#/app/foo');
-
- locationStrategy.pushState(null, 'Title', 'foo', '');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', '#/app/foo');
- });
-
- it('should prepend urls with a hash for URLs with query params', () => {
- expect(locationStrategy.prepareExternalUrl('foo?bar')).toEqual('#/app/foo?bar');
-
- locationStrategy.pushState(null, 'Title', 'foo', 'bar=baz');
- expect(platformLocation.spy('pushState'))
- .toHaveBeenCalledWith(null, 'Title', '#/app/foo?bar=baz');
- });
-
- it('should not prepend a hash to external urls for an empty internal URL', () => {
- expect(locationStrategy.prepareExternalUrl('')).toEqual('#/app');
-
- locationStrategy.pushState(null, 'Title', '', '');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', '#/app');
- });
- });
-
- describe('with APP_BASE_HREF with both leading and trailing slash', () => {
- beforeEachProviders(() => [{provide: APP_BASE_HREF, useValue: '/app/'}]);
-
- beforeEach(inject(
- [PlatformLocation, HashLocationStrategy],
- (pl: any /** TODO #9100 */, ls: any /** TODO #9100 */) => {
- platformLocation = pl;
- locationStrategy = ls;
- platformLocation.spy('pushState');
- platformLocation.pathname = '';
- }));
-
- it('should prepend urls with a hash for non-empty URLs', () => {
- expect(locationStrategy.prepareExternalUrl('foo')).toEqual('#/app/foo');
-
- locationStrategy.pushState(null, 'Title', 'foo', '');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', '#/app/foo');
- });
-
- it('should prepend urls with a hash for URLs with query params', () => {
- expect(locationStrategy.prepareExternalUrl('foo?bar')).toEqual('#/app/foo?bar');
-
- locationStrategy.pushState(null, 'Title', 'foo', 'bar=baz');
- expect(platformLocation.spy('pushState'))
- .toHaveBeenCalledWith(null, 'Title', '#/app/foo?bar=baz');
- });
-
- it('should not prepend a hash to external urls for an empty internal URL', () => {
- expect(locationStrategy.prepareExternalUrl('')).toEqual('#/app/');
-
- locationStrategy.pushState(null, 'Title', '', '');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', '#/app/');
- });
- });
-
- describe('hashLocationStrategy bugs', () => {
- beforeEach(inject(
- [PlatformLocation, HashLocationStrategy],
- (pl: any /** TODO #9100 */, ls: any /** TODO #9100 */) => {
- platformLocation = pl;
- locationStrategy = ls;
- platformLocation.spy('pushState');
- platformLocation.pathname = '';
- }));
-
- it('should not include platform search', () => {
- platformLocation.search = '?donotinclude';
- expect(locationStrategy.path()).toEqual('');
- });
-
- it('should not include platform search even with hash', () => {
- platformLocation.hash = '#hashPath';
- platformLocation.search = '?donotinclude';
- expect(locationStrategy.path()).toEqual('hashPath');
- });
- });
- });
-}
diff --git a/modules/@angular/router-deprecated/test/location/location_spec.ts b/modules/@angular/router-deprecated/test/location/location_spec.ts
deleted file mode 100644
index 568bae4906..0000000000
--- a/modules/@angular/router-deprecated/test/location/location_spec.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Location, LocationStrategy} from '@angular/common';
-import {MockLocationStrategy} from '@angular/common/testing/mock_location_strategy';
-import {ReflectiveInjector} from '@angular/core';
-import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it} from '@angular/core/testing/testing_internal';
-
-export function main() {
- describe('Location', () => {
-
- var locationStrategy: any /** TODO #9100 */, location: any /** TODO #9100 */;
-
- function makeLocation(baseHref: string = '/my/app', provider: any = []): Location {
- locationStrategy = new MockLocationStrategy();
- locationStrategy.internalBaseHref = baseHref;
- let injector = ReflectiveInjector.resolveAndCreate(
- [Location, {provide: LocationStrategy, useValue: locationStrategy}, provider]);
- return location = injector.get(Location);
- }
-
- beforeEach(makeLocation);
-
- it('should not prepend urls with starting slash when an empty URL is provided',
- () => { expect(location.prepareExternalUrl('')).toEqual(locationStrategy.getBaseHref()); });
-
- it('should not prepend path with an extra slash when a baseHref has a trailing slash', () => {
- let location = makeLocation('/my/slashed/app/');
- expect(location.prepareExternalUrl('/page')).toEqual('/my/slashed/app/page');
- });
-
- it('should not append urls with leading slash on navigate', () => {
- location.go('/my/app/user/btford');
- expect(locationStrategy.path()).toEqual('/my/app/user/btford');
- });
-
- it('should normalize urls on popstate',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
-
- location.subscribe((ev: any /** TODO #9100 */) => {
- expect(ev['url']).toEqual('/user/btford');
- async.done();
- });
- locationStrategy.simulatePopState('/my/app/user/btford');
- }));
-
- it('should revert to the previous path when a back() operation is executed', () => {
- var locationStrategy = new MockLocationStrategy();
- var location = new Location(locationStrategy);
-
- function assertUrl(path: any /** TODO #9100 */) { expect(location.path()).toEqual(path); }
-
- location.go('/ready');
- assertUrl('/ready');
-
- location.go('/ready/set');
- assertUrl('/ready/set');
-
- location.go('/ready/set/go');
- assertUrl('/ready/set/go');
-
- location.back();
- assertUrl('/ready/set');
-
- location.back();
- assertUrl('/ready');
- });
-
- it('should incorporate the provided query values into the location change', () => {
- var locationStrategy = new MockLocationStrategy();
- var location = new Location(locationStrategy);
-
- location.go('/home', 'key=value');
- expect(location.path()).toEqual('/home?key=value');
- });
- });
-}
diff --git a/modules/@angular/router-deprecated/test/location/path_location_strategy_spec.ts b/modules/@angular/router-deprecated/test/location/path_location_strategy_spec.ts
deleted file mode 100644
index 3b6f62ce80..0000000000
--- a/modules/@angular/router-deprecated/test/location/path_location_strategy_spec.ts
+++ /dev/null
@@ -1,178 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {APP_BASE_HREF, LocationStrategy, PathLocationStrategy, PlatformLocation} from '@angular/common';
-import {Injector, provide} from '@angular/core';
-import {beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it} from '@angular/core/testing/testing_internal';
-
-import {SpyPlatformLocation} from '../spies';
-
-export function main() {
- describe('PathLocationStrategy', () => {
- var platformLocation: any /** TODO #9100 */, locationStrategy: any /** TODO #9100 */;
-
- beforeEachProviders(() => [PathLocationStrategy, {
- provide: PlatformLocation,
- useFactory: makeSpyPlatformLocation
- }]);
-
- it('should throw without a base element or APP_BASE_HREF', () => {
- platformLocation = new SpyPlatformLocation();
- platformLocation.pathname = '';
- platformLocation.spy('getBaseHrefFromDOM').andReturn(null);
-
- expect(() => new PathLocationStrategy(platformLocation))
- .toThrowError(
- 'No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.');
- });
-
- describe('without APP_BASE_HREF', () => {
- beforeEach(inject(
- [PlatformLocation, PathLocationStrategy],
- (pl: any /** TODO #9100 */, ls: any /** TODO #9100 */) => {
- platformLocation = pl;
- locationStrategy = ls;
- }));
-
- it('should prepend urls with a hash for non-empty URLs', () => {
- expect(locationStrategy.prepareExternalUrl('foo')).toEqual('foo');
-
- locationStrategy.pushState(null, 'Title', 'foo', '');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', 'foo');
- });
-
- it('should prepend urls with a hash for URLs with query params', () => {
- expect(locationStrategy.prepareExternalUrl('foo?bar')).toEqual('foo?bar');
-
- locationStrategy.pushState(null, 'Title', 'foo', 'bar=baz');
- expect(platformLocation.spy('pushState'))
- .toHaveBeenCalledWith(null, 'Title', 'foo?bar=baz');
- });
-
- it('should not prepend a hash to external urls for an empty internal URL', () => {
- expect(locationStrategy.prepareExternalUrl('')).toEqual('');
-
- locationStrategy.pushState(null, 'Title', '', '');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', '');
- });
- });
-
- describe('with APP_BASE_HREF with neither leading nor trailing slash', () => {
- beforeEachProviders(() => [{provide: APP_BASE_HREF, useValue: 'app'}]);
-
- beforeEach(inject(
- [PlatformLocation, PathLocationStrategy],
- (pl: any /** TODO #9100 */, ls: any /** TODO #9100 */) => {
- platformLocation = pl;
- locationStrategy = ls;
- platformLocation.spy('pushState');
- platformLocation.pathname = '';
- }));
-
- it('should prepend urls with a hash for non-empty URLs', () => {
- expect(locationStrategy.prepareExternalUrl('foo')).toEqual('app/foo');
-
- locationStrategy.pushState(null, 'Title', 'foo', '');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', 'app/foo');
- });
-
- it('should prepend urls with a hash for URLs with query params', () => {
- expect(locationStrategy.prepareExternalUrl('foo?bar')).toEqual('app/foo?bar');
-
- locationStrategy.pushState(null, 'Title', 'foo', 'bar=baz');
- expect(platformLocation.spy('pushState'))
- .toHaveBeenCalledWith(null, 'Title', 'app/foo?bar=baz');
- });
-
- it('should not prepend a hash to external urls for an empty internal URL', () => {
- expect(locationStrategy.prepareExternalUrl('')).toEqual('app');
-
- locationStrategy.pushState(null, 'Title', '', '');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', 'app');
- });
- });
-
- describe('with APP_BASE_HREF with leading slash', () => {
- beforeEachProviders(() => [{provide: APP_BASE_HREF, useValue: '/app'}]);
-
- beforeEach(inject(
- [PlatformLocation, PathLocationStrategy],
- (pl: any /** TODO #9100 */, ls: any /** TODO #9100 */) => {
- platformLocation = pl;
- locationStrategy = ls;
- platformLocation.spy('pushState');
- platformLocation.pathname = '';
- }));
-
- it('should prepend urls with a hash for non-empty URLs', () => {
- expect(locationStrategy.prepareExternalUrl('foo')).toEqual('/app/foo');
-
- locationStrategy.pushState(null, 'Title', 'foo', '');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', '/app/foo');
- });
-
- it('should prepend urls with a hash for URLs with query params', () => {
- expect(locationStrategy.prepareExternalUrl('foo?bar')).toEqual('/app/foo?bar');
-
- locationStrategy.pushState(null, 'Title', 'foo', 'bar=baz');
- expect(platformLocation.spy('pushState'))
- .toHaveBeenCalledWith(null, 'Title', '/app/foo?bar=baz');
- });
-
- it('should not prepend a hash to external urls for an empty internal URL', () => {
- expect(locationStrategy.prepareExternalUrl('')).toEqual('/app');
-
- locationStrategy.pushState(null, 'Title', '', '');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', '/app');
- });
- });
-
- describe('with APP_BASE_HREF with both leading and trailing slash', () => {
- beforeEachProviders(() => [{provide: APP_BASE_HREF, useValue: '/app/'}]);
-
- beforeEach(inject(
- [PlatformLocation, PathLocationStrategy],
- (pl: any /** TODO #9100 */, ls: any /** TODO #9100 */) => {
- platformLocation = pl;
- locationStrategy = ls;
- platformLocation.spy('pushState');
- platformLocation.pathname = '';
- }));
-
- it('should prepend urls with a hash for non-empty URLs', () => {
- expect(locationStrategy.prepareExternalUrl('foo')).toEqual('/app/foo');
-
- locationStrategy.pushState(null, 'Title', 'foo', '');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', '/app/foo');
- });
-
- it('should prepend urls with a hash for URLs with query params', () => {
- expect(locationStrategy.prepareExternalUrl('foo?bar')).toEqual('/app/foo?bar');
-
- locationStrategy.pushState(null, 'Title', 'foo', 'bar=baz');
- expect(platformLocation.spy('pushState'))
- .toHaveBeenCalledWith(null, 'Title', '/app/foo?bar=baz');
- });
-
- it('should not prepend a hash to external urls for an empty internal URL', () => {
- expect(locationStrategy.prepareExternalUrl('')).toEqual('/app/');
-
- locationStrategy.pushState(null, 'Title', '', '');
- expect(platformLocation.spy('pushState')).toHaveBeenCalledWith(null, 'Title', '/app/');
- });
- });
- });
-}
-
-function makeSpyPlatformLocation() {
- var platformLocation = new SpyPlatformLocation();
- platformLocation.spy('getBaseHrefFromDOM').andReturn('');
- platformLocation.spy('pushState');
- platformLocation.pathname = '';
- return platformLocation;
-}
diff --git a/modules/@angular/router-deprecated/test/route_config/route_config_spec.ts b/modules/@angular/router-deprecated/test/route_config/route_config_spec.ts
deleted file mode 100644
index bab4b52c9e..0000000000
--- a/modules/@angular/router-deprecated/test/route_config/route_config_spec.ts
+++ /dev/null
@@ -1,288 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {LocationStrategy} from '@angular/common';
-import {MockLocationStrategy} from '@angular/common/testing/mock_location_strategy';
-import {ExceptionHandler, disposePlatform} from '@angular/core';
-import {Console} from '@angular/core/src/console';
-import {Component, Directive} from '@angular/core/src/metadata';
-import {AsyncTestCompleter, beforeEach, ddescribe, describe, iit, inject, it, xdescribe, xit} from '@angular/core/testing/testing_internal';
-import {bootstrap} from '@angular/platform-browser-dynamic';
-import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
-import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
-import {expect} from '@angular/platform-browser/testing/matchers';
-import {ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig, Router} from '@angular/router-deprecated';
-
-class _ArrayLogger {
- res: any[] = [];
- log(s: any): void { this.res.push(s); }
- logError(s: any): void { this.res.push(s); }
- logGroup(s: any): void { this.res.push(s); }
- logGroupEnd(){};
-}
-
-class DummyConsole implements Console {
- log(message: any /** TODO #9100 */) {}
- warn(message: any /** TODO #9100 */) {}
-}
-
-export function main() {
- describe('RouteConfig with POJO arguments', () => {
- var fakeDoc: any /** TODO #9100 */, el: any /** TODO #9100 */,
- testBindings: any /** TODO #9100 */;
- beforeEach(() => {
- disposePlatform();
- fakeDoc = getDOM().createHtmlDocument();
- el = getDOM().createElement('app-cmp', fakeDoc);
- getDOM().appendChild(fakeDoc.body, el);
- var logger = new _ArrayLogger();
- var exceptionHandler = new ExceptionHandler(logger, false);
- testBindings = [
- ROUTER_PROVIDERS, {provide: LocationStrategy, useClass: MockLocationStrategy},
- {provide: DOCUMENT, useValue: fakeDoc},
- {provide: ExceptionHandler, useValue: exceptionHandler},
- {provide: Console, useClass: DummyConsole}
- ];
- });
-
- afterEach(() => disposePlatform());
-
- it('should bootstrap an app with a hierarchy',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- bootstrap(HierarchyAppCmp, testBindings).then((applicationRef) => {
- var router = applicationRef.instance.router;
- router.subscribe((_: any /** TODO #9100 */) => {
- expect(el).toHaveText('root [ parent [ hello ] ]');
- expect(applicationRef.instance.location.path()).toEqual('/parent/child');
- async.done();
- });
- router.navigateByUrl('/parent/child');
- });
- }));
-
-
- it('should work in an app with redirects',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- bootstrap(RedirectAppCmp, testBindings).then((applicationRef) => {
- var router = applicationRef.instance.router;
- router.subscribe((_: any /** TODO #9100 */) => {
- expect(el).toHaveText('root [ hello ]');
- expect(applicationRef.instance.location.path()).toEqual('/after');
- async.done();
- });
- router.navigateByUrl('/before');
- });
- }));
-
-
- it('should work in an app with async components',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- bootstrap(AsyncAppCmp, testBindings).then((applicationRef) => {
- var router = applicationRef.instance.router;
- router.subscribe((_: any /** TODO #9100 */) => {
- expect(el).toHaveText('root [ hello ]');
- expect(applicationRef.instance.location.path()).toEqual('/hello');
- async.done();
- });
- router.navigateByUrl('/hello');
- });
- }));
-
-
- it('should work in an app with aux routes',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- bootstrap(AuxAppCmp, testBindings).then((applicationRef) => {
- var router = applicationRef.instance.router;
- router.subscribe((_: any /** TODO #9100 */) => {
- expect(el).toHaveText('root [ hello ] aside [ hello ]');
- expect(applicationRef.instance.location.path()).toEqual('/hello(aside)');
- async.done();
- });
- router.navigateByUrl('/hello(aside)');
- });
- }));
-
-
- it('should work in an app with async components defined with "loader"',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- bootstrap(ConciseAsyncAppCmp, testBindings).then((applicationRef) => {
- var router = applicationRef.instance.router;
- router.subscribe((_: any /** TODO #9100 */) => {
- expect(el).toHaveText('root [ hello ]');
- expect(applicationRef.instance.location.path()).toEqual('/hello');
- async.done();
- });
- router.navigateByUrl('/hello');
- });
- }));
-
-
- it('should work in an app with a constructor component',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- bootstrap(ExplicitConstructorAppCmp, testBindings).then((applicationRef) => {
- var router = applicationRef.instance.router;
- router.subscribe((_: any /** TODO #9100 */) => {
- expect(el).toHaveText('root [ hello ]');
- expect(applicationRef.instance.location.path()).toEqual('/hello');
- async.done();
- });
- router.navigateByUrl('/hello');
- });
- }));
-
- it('should throw if a config is missing a target',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- bootstrap(WrongConfigCmp, testBindings).catch((e) => {
- expect(e.originalException)
- .toContainError(
- 'Route config should contain exactly one "component", "loader", or "redirectTo" property.');
- async.done();
- return null;
- });
- }));
-
- it('should throw if a config has an invalid component type',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- bootstrap(WrongComponentTypeCmp, testBindings).catch((e) => {
- expect(e.originalException)
- .toContainError(
- 'Invalid component type "intentionallyWrongComponentType". Valid types are "constructor" and "loader".');
- async.done();
- return null;
- });
- }));
-
- it('should throw if a config has an invalid alias name',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- bootstrap(BadAliasNameCmp, testBindings).catch((e) => {
- expect(e.originalException)
- .toContainError(
- `Route "/child" with name "child" does not begin with an uppercase letter. Route names should be PascalCase like "Child".`);
- async.done();
- return null;
- });
- }));
-
- });
-}
-
-
-@Component({selector: 'hello-cmp', template: 'hello'})
-class HelloCmp {
-}
-
-@Component({
- selector: 'app-cmp',
- template: `root [ ]`,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([
- {path: '/before', redirectTo: ['Hello']}, {path: '/after', component: HelloCmp, name: 'Hello'}
-])
-class RedirectAppCmp {
- constructor(public router: Router, public location: LocationStrategy) {}
-}
-
-function HelloLoader(): Promise {
- return Promise.resolve(HelloCmp);
-}
-
-@Component({
- selector: 'app-cmp',
- template: `root [ ]`,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([
- {path: '/hello', component: {type: 'loader', loader: HelloLoader}},
-])
-class AsyncAppCmp {
- constructor(public router: Router, public location: LocationStrategy) {}
-}
-
-@Component({
- selector: 'app-cmp',
- template: `root [ ]`,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([
- {path: '/hello', loader: HelloLoader},
-])
-class ConciseAsyncAppCmp {
- constructor(public router: Router, public location: LocationStrategy) {}
-}
-
-@Component({
- selector: 'app-cmp',
- template:
- `root [ ] aside [ ]`,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([{path: '/hello', component: HelloCmp}, {aux: 'aside', component: HelloCmp}])
-class AuxAppCmp {
- constructor(public router: Router, public location: LocationStrategy) {}
-}
-
-@Component({
- selector: 'app-cmp',
- template: `root [ ]`,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([
- {path: '/hello', component: {type: 'constructor', constructor: HelloCmp}},
-])
-class ExplicitConstructorAppCmp {
- constructor(public router: Router, public location: LocationStrategy) {}
-}
-
-@Component({
- selector: 'parent-cmp',
- template: `parent [ ]`,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([{path: '/child', component: HelloCmp}])
-class ParentCmp {
-}
-
-@Component({
- selector: 'app-cmp',
- template: `root [ ]`,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([{path: '/parent/...', component: ParentCmp}])
-class HierarchyAppCmp {
- constructor(public router: Router, public location: LocationStrategy) {}
-}
-
-@Component({
- selector: 'app-cmp',
- template: `root [ ]`,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([{path: '/hello'}])
-class WrongConfigCmp {
-}
-
-@Component({
- selector: 'app-cmp',
- template: `root [ ]`,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([{path: '/child', component: HelloCmp, name: 'child'}])
-class BadAliasNameCmp {
-}
-
-@Component({
- selector: 'app-cmp',
- template: `root [ ]`,
- directives: ROUTER_DIRECTIVES
-})
-@RouteConfig([
- {path: '/hello', component: {type: 'intentionallyWrongComponentType', constructor: HelloCmp}},
-])
-class WrongComponentTypeCmp {
-}
diff --git a/modules/@angular/router-deprecated/test/route_registry_spec.ts b/modules/@angular/router-deprecated/test/route_registry_spec.ts
deleted file mode 100644
index cf02fe2ad1..0000000000
--- a/modules/@angular/router-deprecated/test/route_registry_spec.ts
+++ /dev/null
@@ -1,365 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {AsyncTestCompleter, beforeEach, ddescribe, describe, expect, iit, inject, it} from '@angular/core/testing/testing_internal';
-import {Type} from '../src/facade/lang';
-import {AsyncRoute, AuxRoute, Redirect, Route, RouteConfig} from '../src/route_config/route_config_decorator';
-import {RouteRegistry} from '../src/route_registry';
-
-
-export function main() {
- describe('RouteRegistry', () => {
- var registry: RouteRegistry;
-
- beforeEach(() => { registry = new RouteRegistry(RootHostCmp); });
-
- it('should match the full URL', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- registry.config(RootHostCmp, new Route({path: '/', component: DummyCmpA}));
- registry.config(RootHostCmp, new Route({path: '/test', component: DummyCmpB}));
-
- registry.recognize('/test', []).then((instruction) => {
- expect(instruction.component.componentType).toBe(DummyCmpB);
- async.done();
- });
- }));
-
- it('should generate URLs starting at the given component', () => {
- registry.config(
- RootHostCmp,
- new Route({path: '/first/...', component: DummyParentCmp, name: 'FirstCmp'}));
-
- var instr = registry.generate(['FirstCmp', 'SecondCmp'], []);
- expect(stringifyInstruction(instr)).toEqual('first/second');
-
- expect(stringifyInstruction(registry.generate(['SecondCmp'], [instr, instr.child])))
- .toEqual('first/second');
- expect(stringifyInstruction(registry.generate(['./SecondCmp'], [instr, instr.child])))
- .toEqual('first/second');
- });
-
- it('should generate URLs that account for default routes', () => {
- registry.config(
- RootHostCmp,
- new Route({path: '/first/...', component: ParentWithDefaultRouteCmp, name: 'FirstCmp'}));
-
- var instruction = registry.generate(['FirstCmp'], []);
-
- expect(instruction.toLinkUrl()).toEqual('first');
- expect(instruction.toRootUrl()).toEqual('first/second');
- });
-
- it('should generate URLs in a hierarchy of default routes', () => {
- registry.config(
- RootHostCmp,
- new Route({path: '/first/...', component: MultipleDefaultCmp, name: 'FirstCmp'}));
-
- var instruction = registry.generate(['FirstCmp'], []);
-
- expect(instruction.toLinkUrl()).toEqual('first');
- expect(instruction.toRootUrl()).toEqual('first/second/third');
- });
-
- it('should generate URLs with params', () => {
- registry.config(
- RootHostCmp,
- new Route({path: '/first/:param/...', component: DummyParentParamCmp, name: 'FirstCmp'}));
-
- var url = stringifyInstruction(
- registry.generate(['FirstCmp', {param: 'one'}, 'SecondCmp', {param: 'two'}], []));
- expect(url).toEqual('first/one/second/two');
- });
-
- it('should generate params as an empty StringMap when no params are given', () => {
- registry.config(RootHostCmp, new Route({path: '/test', component: DummyCmpA, name: 'Test'}));
- var instruction = registry.generate(['Test'], []);
- expect(instruction.component.params).toEqual({});
- });
-
- it('should generate URLs with extra params in the query', () => {
- registry.config(
- RootHostCmp, new Route({path: '/first/second', component: DummyCmpA, name: 'FirstCmp'}));
-
- var instruction = registry.generate(['FirstCmp', {a: 'one'}], []);
- expect(instruction.toLinkUrl()).toEqual('first/second?a=one');
- });
-
-
- it('should generate URLs of loaded components after they are loaded',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- registry.config(
- RootHostCmp,
- new AsyncRoute({path: '/first/...', loader: asyncParentLoader, name: 'FirstCmp'}));
-
- var instruction = registry.generate(['FirstCmp', 'SecondCmp'], []);
-
- expect(stringifyInstruction(instruction)).toEqual('first');
-
- registry.recognize('/first/second', []).then((_) => {
- var instruction = registry.generate(['FirstCmp', 'SecondCmp'], []);
- expect(stringifyInstruction(instruction)).toEqual('first/second');
- async.done();
- });
- }));
-
- it('should throw when generating a url and a parent has no config', () => {
- expect(() => registry.generate(['FirstCmp', 'SecondCmp'], [
- ])).toThrowError('Component "RootHostCmp" has no route config.');
- });
-
- it('should generate URLs for aux routes', () => {
- registry.config(
- RootHostCmp, new Route({path: '/primary', component: DummyCmpA, name: 'Primary'}));
- registry.config(RootHostCmp, new AuxRoute({path: '/aux', component: DummyCmpB, name: 'Aux'}));
-
- expect(stringifyInstruction(registry.generate(['Primary', ['Aux']], [
- ]))).toEqual('primary(aux)');
- });
-
- it('should prefer static segments to dynamic',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- registry.config(RootHostCmp, new Route({path: '/:site', component: DummyCmpB}));
- registry.config(RootHostCmp, new Route({path: '/home', component: DummyCmpA}));
-
- registry.recognize('/home', []).then((instruction) => {
- expect(instruction.component.componentType).toBe(DummyCmpA);
- async.done();
- });
- }));
-
- it('should prefer dynamic segments to star',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- registry.config(RootHostCmp, new Route({path: '/:site', component: DummyCmpA}));
- registry.config(RootHostCmp, new Route({path: '/*site', component: DummyCmpB}));
-
- registry.recognize('/home', []).then((instruction) => {
- expect(instruction.component.componentType).toBe(DummyCmpA);
- async.done();
- });
- }));
-
- it('should prefer routes with more dynamic segments',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- registry.config(RootHostCmp, new Route({path: '/:first/*rest', component: DummyCmpA}));
- registry.config(RootHostCmp, new Route({path: '/*all', component: DummyCmpB}));
-
- registry.recognize('/some/path', []).then((instruction) => {
- expect(instruction.component.componentType).toBe(DummyCmpA);
- async.done();
- });
- }));
-
- it('should prefer routes with more static segments',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- registry.config(RootHostCmp, new Route({path: '/first/:second', component: DummyCmpA}));
- registry.config(RootHostCmp, new Route({path: '/:first/:second', component: DummyCmpB}));
-
- registry.recognize('/first/second', []).then((instruction) => {
- expect(instruction.component.componentType).toBe(DummyCmpA);
- async.done();
- });
- }));
-
- it('should prefer routes with static segments before dynamic segments',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- registry.config(
- RootHostCmp, new Route({path: '/first/second/:third', component: DummyCmpB}));
- registry.config(
- RootHostCmp, new Route({path: '/first/:second/third', component: DummyCmpA}));
-
- registry.recognize('/first/second/third', []).then((instruction) => {
- expect(instruction.component.componentType).toBe(DummyCmpB);
- async.done();
- });
- }));
-
- it('should prefer routes with high specificity over routes with children with lower specificity',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- registry.config(RootHostCmp, new Route({path: '/first', component: DummyCmpA}));
-
- // terminates to DummyCmpB
- registry.config(
- RootHostCmp, new Route({path: '/:second/...', component: SingleSlashChildCmp}));
-
- registry.recognize('/first', []).then((instruction) => {
- expect(instruction.component.componentType).toBe(DummyCmpA);
- async.done();
- });
- }));
-
- it('should match the full URL using child components',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- registry.config(RootHostCmp, new Route({path: '/first/...', component: DummyParentCmp}));
-
- registry.recognize('/first/second', []).then((instruction) => {
- expect(instruction.component.componentType).toBe(DummyParentCmp);
- expect(instruction.child.component.componentType).toBe(DummyCmpB);
- async.done();
- });
- }));
-
- it('should match the URL using async child components',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- registry.config(RootHostCmp, new Route({path: '/first/...', component: DummyAsyncCmp}));
-
- registry.recognize('/first/second', []).then((instruction) => {
- expect(instruction.component.componentType).toBe(DummyAsyncCmp);
-
- instruction.child.resolveComponent().then((childComponentInstruction) => {
- expect(childComponentInstruction.componentType).toBe(DummyCmpB);
- async.done();
- });
- });
- }));
-
- it('should match the URL using an async parent component',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- registry.config(
- RootHostCmp, new AsyncRoute({path: '/first/...', loader: asyncParentLoader}));
-
- registry.recognize('/first/second', []).then((instruction) => {
- expect(instruction.component.componentType).toBe(DummyParentCmp);
-
- instruction.child.resolveComponent().then((childType) => {
- expect(childType.componentType).toBe(DummyCmpB);
- async.done();
- });
- });
- }));
-
- it('should throw when a parent config is missing the `...` suffix any of its children add routes',
- () => {
- expect(
- () => registry.config(RootHostCmp, new Route({path: '/', component: DummyParentCmp})))
- .toThrowError(
- 'Child routes are not allowed for "/". Use "..." on the parent\'s route path.');
- });
-
- it('should throw when a parent config uses `...` suffix before the end of the route', () => {
- expect(
- () => registry.config(
- RootHostCmp, new Route({path: '/home/.../fun/', component: DummyParentCmp})))
- .toThrowError('Unexpected "..." before the end of the path for "home/.../fun/".');
- });
-
-
- it('should throw if a config has a component that is not defined', () => {
- expect(() => registry.config(RootHostCmp, new Route({path: '/', component: null})))
- .toThrowError('Component for route "/" is not defined, or is not a class.');
- expect(() => registry.config(RootHostCmp, new AuxRoute({path: '/', component: null})))
- .toThrowError('Component for route "/" is not defined, or is not a class.');
-
- expect(() => registry.config(RootHostCmp, new Route({path: '/', component: (4)})))
- .toThrowError('Component for route "/" is not defined, or is not a class.');
- });
-
- it('should throw when linkParams are not terminal', () => {
- registry.config(
- RootHostCmp, new Route({path: '/first/...', component: DummyParentCmp, name: 'First'}));
- expect(() => {
- registry.generate(['First'], []);
- }).toThrowError(/Link "\["First"\]" does not resolve to a terminal instruction./);
- });
-
- it('should match matrix params on child components and query params on the root component',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- registry.config(RootHostCmp, new Route({path: '/first/...', component: DummyParentCmp}));
-
- registry.recognize('/first/second;filter=odd?comments=all', []).then((instruction) => {
- expect(instruction.component.componentType).toBe(DummyParentCmp);
- expect(instruction.component.params).toEqual({'comments': 'all'});
-
- expect(instruction.child.component.componentType).toBe(DummyCmpB);
- expect(instruction.child.component.params).toEqual({'filter': 'odd'});
- async.done();
- });
- }));
-
- it('should match query params on the root component even when the next URL segment is null',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- registry.config(
- RootHostCmp, new Route({path: '/first/...', component: SingleSlashChildCmp}));
-
- registry.recognize('/first?comments=all', []).then((instruction) => {
- expect(instruction.component.componentType).toBe(SingleSlashChildCmp);
- expect(instruction.component.params).toEqual({'comments': 'all'});
-
- expect(instruction.child.component.componentType).toBe(DummyCmpB);
- expect(instruction.child.component.params).toEqual({});
- async.done();
- });
- }));
-
- it('should generate URLs with matrix and query params', () => {
- registry.config(
- RootHostCmp,
- new Route({path: '/first/:param/...', component: DummyParentParamCmp, name: 'FirstCmp'}));
-
- var url = stringifyInstruction(registry.generate(
- [
- 'FirstCmp', {param: 'one', query: 'cats'}, 'SecondCmp', {
- param: 'two',
- sort: 'asc',
- }
- ],
- []));
- expect(url).toEqual('first/one/second/two;sort=asc?query=cats');
- });
-
- });
-}
-
-function stringifyInstruction(instruction: any /** TODO #9100 */): string {
- return instruction.toRootUrl();
-}
-
-
-function asyncParentLoader() {
- return Promise.resolve(DummyParentCmp);
-}
-
-function asyncChildLoader() {
- return Promise.resolve(DummyCmpB);
-}
-
-class RootHostCmp {}
-
-@RouteConfig([new AsyncRoute({path: '/second', loader: asyncChildLoader})])
-class DummyAsyncCmp {
-}
-
-class DummyCmpA {}
-class DummyCmpB {}
-
-@RouteConfig(
- [new Route({path: '/third', component: DummyCmpB, name: 'ThirdCmp', useAsDefault: true})])
-class DefaultRouteCmp {
-}
-
-@RouteConfig([new Route({path: '/', component: DummyCmpB, name: 'ThirdCmp'})])
-class SingleSlashChildCmp {
-}
-
-
-@RouteConfig([new Route(
- {path: '/second/...', component: DefaultRouteCmp, name: 'SecondCmp', useAsDefault: true})])
-class MultipleDefaultCmp {
-}
-
-@RouteConfig(
- [new Route({path: '/second', component: DummyCmpB, name: 'SecondCmp', useAsDefault: true})])
-class ParentWithDefaultRouteCmp {
-}
-
-@RouteConfig([new Route({path: '/second', component: DummyCmpB, name: 'SecondCmp'})])
-class DummyParentCmp {
-}
-
-
-@RouteConfig([new Route({path: '/second/:param', component: DummyCmpB, name: 'SecondCmp'})])
-class DummyParentParamCmp {
-}
diff --git a/modules/@angular/router-deprecated/test/router_spec.ts b/modules/@angular/router-deprecated/test/router_spec.ts
deleted file mode 100644
index 2a01749e98..0000000000
--- a/modules/@angular/router-deprecated/test/router_spec.ts
+++ /dev/null
@@ -1,346 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Location} from '@angular/common';
-import {SpyLocation} from '@angular/common/testing';
-import {provide} from '@angular/core';
-import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe, expect, iit, inject, it, xit} from '@angular/core/testing/testing_internal';
-
-import {RouterOutlet} from '../src/directives/router_outlet';
-import {ListWrapper} from '../src/facade/collection';
-import {Type} from '../src/facade/lang';
-import {AsyncRoute, Redirect, Route, RouteConfig} from '../src/route_config/route_config_decorator';
-import {ROUTER_PRIMARY_COMPONENT, RouteRegistry} from '../src/route_registry';
-import {RootRouter, Router} from '../src/router';
-
-import {SpyRouterOutlet} from './spies';
-
-export function main() {
- describe('Router', () => {
- var router: Router;
- var location: Location;
-
- beforeEachProviders(
- () =>
- [RouteRegistry, {provide: Location, useClass: SpyLocation},
- {provide: ROUTER_PRIMARY_COMPONENT, useValue: AppCmp},
- {provide: Router, useClass: RootRouter}]);
-
-
- beforeEach(inject([Router, Location], (rtr: Router, loc: Location) => {
- router = rtr;
- location = loc;
- }));
-
-
- it('should navigate based on the initial URL state',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- var outlet = makeDummyOutlet();
-
- router.config([new Route({path: '/', component: DummyComponent})])
- .then((_) => router.registerPrimaryOutlet(outlet))
- .then((_) => {
- expect((outlet).spy('activate')).toHaveBeenCalled();
- expect((location).urlChanges).toEqual([]);
- async.done();
- });
- }));
-
- it('should activate viewports and update URL on navigate',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- var outlet = makeDummyOutlet();
-
- router.registerPrimaryOutlet(outlet)
- .then((_) => router.config([new Route({path: '/a', component: DummyComponent})]))
- .then((_) => router.navigateByUrl('/a'))
- .then((_) => {
- expect((outlet).spy('activate')).toHaveBeenCalled();
- expect((location).urlChanges).toEqual(['/a']);
- async.done();
- });
- }));
-
- it('should activate viewports and update URL when navigating via DSL',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- var outlet = makeDummyOutlet();
-
- router.registerPrimaryOutlet(outlet)
- .then(
- (_) =>
- router.config([new Route({path: '/a', component: DummyComponent, name: 'A'})]))
- .then((_) => router.navigate(['/A']))
- .then((_) => {
- expect((outlet).spy('activate')).toHaveBeenCalled();
- expect((location).urlChanges).toEqual(['/a']);
- async.done();
- });
- }));
-
- it('should not push a history change on when navigate is called with skipUrlChange',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- var outlet = makeDummyOutlet();
-
- router.registerPrimaryOutlet(outlet)
- .then((_) => router.config([new Route({path: '/b', component: DummyComponent})]))
- .then((_) => router.navigateByUrl('/b', true))
- .then((_) => {
- expect((outlet).spy('activate')).toHaveBeenCalled();
- expect((location).urlChanges).toEqual([]);
- async.done();
- });
- }));
-
- // See https://github.com/angular/angular/issues/5590
- // This test is disabled because it is flaky.
- // TODO: bford. make this test not flaky and reenable it.
- xit('should replace history when triggered by a hashchange with a redirect',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- var outlet = makeDummyOutlet();
-
- router.registerPrimaryOutlet(outlet)
- .then((_) => router.config([
- new Redirect({path: '/a', redirectTo: ['B']}),
- new Route({path: '/b', component: DummyComponent, name: 'B'})
- ]))
- .then((_) => {
- router.subscribe((_) => {
- expect((location).urlChanges).toEqual(['hash: a', 'replace: /b']);
- async.done();
- });
-
- (location).simulateHashChange('a');
- });
- }));
-
- it('should push history when triggered by a hashchange without a redirect',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- var outlet = makeDummyOutlet();
-
- router.registerPrimaryOutlet(outlet)
- .then((_) => router.config([new Route({path: '/a', component: DummyComponent})]))
- .then((_) => {
- router.subscribe((_) => {
- expect((location).urlChanges).toEqual(['hash: a']);
- async.done();
- });
-
- (location).simulateHashChange('a');
- });
- }));
-
-
- it('should pass an object containing the component instruction to the router change subscription after a successful navigation',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- var outlet = makeDummyOutlet();
-
- router.registerPrimaryOutlet(outlet)
- .then((_) => router.config([new Route({path: '/a', component: DummyComponent})]))
- .then((_) => {
- router.subscribe(({status, instruction}) => {
- expect(status).toEqual('success');
- expect(instruction)
- .toEqual(jasmine.objectContaining({urlPath: 'a', urlParams: []}));
- async.done();
- });
- (location).simulateHashChange('a');
- });
- }));
-
- it('should pass an object containing the bad url to the router change subscription after a failed navigation',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- var outlet = makeDummyOutlet();
-
- router.registerPrimaryOutlet(outlet)
- .then((_) => router.config([new Route({path: '/a', component: DummyComponent})]))
- .then((_) => {
- router.subscribe(({status, url}) => {
- expect(status).toEqual('fail');
- expect(url).toEqual('b');
- async.done();
- });
- (location).simulateHashChange('b');
- });
- }));
-
- it('should navigate after being configured',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- var outlet = makeDummyOutlet();
-
- router.registerPrimaryOutlet(outlet)
- .then((_) => router.navigateByUrl('/a'))
- .then((_) => {
- expect((outlet).spy('activate')).not.toHaveBeenCalled();
- return router.config([new Route({path: '/a', component: DummyComponent})]);
- })
- .then((_) => {
- expect((outlet).spy('activate')).toHaveBeenCalled();
- async.done();
- });
- }));
-
- it('should throw when linkParams does not include a route name', () => {
- expect(() => router.generate(['./']))
- .toThrowError(`Link "${ListWrapper.toJSON(['./'])}" must include a route name.`);
- expect(() => router.generate(['/']))
- .toThrowError(`Link "${ListWrapper.toJSON(['/'])}" must include a route name.`);
- });
-
- it('should, when subscribed to, return a disposable subscription', () => {
- expect(() => {
- var subscription = router.subscribe((_) => {});
- (subscription).unsubscribe();
- }).not.toThrow();
- });
-
- it('should generate URLs from the root component when the path starts with /', () => {
- router.config(
- [new Route({path: '/first/...', component: DummyParentComp, name: 'FirstCmp'})]);
-
- var instruction = router.generate(['/FirstCmp', 'SecondCmp']);
- expect(stringifyInstruction(instruction)).toEqual('first/second');
-
- instruction = router.generate(['/FirstCmp/SecondCmp']);
- expect(stringifyInstruction(instruction)).toEqual('first/second');
- });
-
- it('should generate an instruction with terminal async routes',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- var outlet = makeDummyOutlet();
-
- router.registerPrimaryOutlet(outlet);
- router.config([new AsyncRoute({path: '/first', loader: loader, name: 'FirstCmp'})]);
-
- var instruction = router.generate(['/FirstCmp']);
- router.navigateByInstruction(instruction).then((_) => {
- expect((outlet).spy('activate')).toHaveBeenCalled();
- async.done();
- });
- }));
-
- it('should return whether a given instruction is active with isRouteActive',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- var outlet = makeDummyOutlet();
-
- router.registerPrimaryOutlet(outlet)
- .then((_) => router.config([
- new Route({path: '/a', component: DummyComponent, name: 'A'}),
- new Route({path: '/b', component: DummyComponent, name: 'B'})
- ]))
- .then((_) => router.navigateByUrl('/a'))
- .then((_) => {
- var instruction = router.generate(['/A']);
- var otherInstruction = router.generate(['/B']);
-
- expect(router.isRouteActive(instruction)).toEqual(true);
- expect(router.isRouteActive(otherInstruction)).toEqual(false);
- async.done();
- });
- }));
-
- it('should provide the current instruction',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- var outlet = makeDummyOutlet();
-
- router.registerPrimaryOutlet(outlet)
- .then((_) => router.config([
- new Route({path: '/a', component: DummyComponent, name: 'A'}),
- new Route({path: '/b', component: DummyComponent, name: 'B'})
- ]))
- .then((_) => router.navigateByUrl('/a'))
- .then((_) => {
- var instruction = router.generate(['/A']);
-
- expect(router.currentInstruction).toEqual(instruction);
- async.done();
- });
- }));
-
- it('should provide the root level router from child routers', () => {
- let childRouter = router.childRouter(DummyComponent);
- expect(childRouter.root).toBe(router);
- });
-
- describe('query string params', () => {
- it('should use query string params for the root route', () => {
- router.config(
- [new Route({path: '/hi/how/are/you', component: DummyComponent, name: 'GreetingUrl'})]);
-
- var instruction = router.generate(['/GreetingUrl', {'name': 'brad'}]);
- var path = stringifyInstruction(instruction);
- expect(path).toEqual('hi/how/are/you?name=brad');
- });
-
- it('should preserve the number 1 as a query string value', () => {
- router.config(
- [new Route({path: '/hi/how/are/you', component: DummyComponent, name: 'GreetingUrl'})]);
-
- var instruction = router.generate(['/GreetingUrl', {'name': 1}]);
- var path = stringifyInstruction(instruction);
- expect(path).toEqual('hi/how/are/you?name=1');
- });
-
- it('should serialize parameters that are not part of the route definition as query string params',
- () => {
- router.config([new Route(
- {path: '/one/two/:three', component: DummyComponent, name: 'NumberUrl'})]);
-
- var instruction = router.generate(['/NumberUrl', {'three': 'three', 'four': 'four'}]);
- var path = stringifyInstruction(instruction);
- expect(path).toEqual('one/two/three?four=four');
- });
- });
-
- describe('matrix params', () => {
- it('should generate matrix params for each non-root component', () => {
- router.config(
- [new Route({path: '/first/...', component: DummyParentComp, name: 'FirstCmp'})]);
-
- var instruction =
- router.generate(['/FirstCmp', {'key': 'value'}, 'SecondCmp', {'project': 'angular'}]);
- var path = stringifyInstruction(instruction);
- expect(path).toEqual('first/second;project=angular?key=value');
- });
-
- it('should work with named params', () => {
- router.config(
- [new Route({path: '/first/:token/...', component: DummyParentComp, name: 'FirstCmp'})]);
-
- var instruction =
- router.generate(['/FirstCmp', {'token': 'min'}, 'SecondCmp', {'author': 'max'}]);
- var path = stringifyInstruction(instruction);
- expect(path).toEqual('first/min/second;author=max');
- });
- });
- });
-}
-
-
-function stringifyInstruction(instruction: any /** TODO #9100 */): string {
- return instruction.toRootUrl();
-}
-
-function loader(): Promise {
- return Promise.resolve(DummyComponent);
-}
-
-class DummyComponent {}
-
-@RouteConfig([new Route({path: '/second', component: DummyComponent, name: 'SecondCmp'})])
-class DummyParentComp {
-}
-
-function makeDummyOutlet(): RouterOutlet {
- var ref = new SpyRouterOutlet();
- ref.spy('canActivate').andCallFake((_: any /** TODO #9100 */) => Promise.resolve(true));
- ref.spy('routerCanReuse').andCallFake((_: any /** TODO #9100 */) => Promise.resolve(false));
- ref.spy('routerCanDeactivate').andCallFake((_: any /** TODO #9100 */) => Promise.resolve(true));
- ref.spy('activate').andCallFake((_: any /** TODO #9100 */) => Promise.resolve(true));
- return ref;
-}
-
-class AppCmp {}
diff --git a/modules/@angular/router-deprecated/test/rules/route_paths/param_route_path_spec.ts b/modules/@angular/router-deprecated/test/rules/route_paths/param_route_path_spec.ts
deleted file mode 100644
index e5e7298276..0000000000
--- a/modules/@angular/router-deprecated/test/rules/route_paths/param_route_path_spec.ts
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {beforeEach, ddescribe, describe, expect, iit, inject, it} from '@angular/core/testing/testing_internal';
-
-import {ParamRoutePath} from '../../../src/rules/route_paths/param_route_path';
-import {Url, parser} from '../../../src/url_parser';
-
-export function main() {
- describe('PathRecognizer', () => {
-
- it('should throw when given an invalid path', () => {
- expect(() => new ParamRoutePath('/hi#'))
- .toThrowError(`Path "/hi#" should not include "#". Use "HashLocationStrategy" instead.`);
- expect(() => new ParamRoutePath('hi?'))
- .toThrowError(`Path "hi?" contains "?" which is not allowed in a route config.`);
- expect(() => new ParamRoutePath('hi;'))
- .toThrowError(`Path "hi;" contains ";" which is not allowed in a route config.`);
- expect(() => new ParamRoutePath('hi='))
- .toThrowError(`Path "hi=" contains "=" which is not allowed in a route config.`);
- expect(() => new ParamRoutePath('hi('))
- .toThrowError(`Path "hi(" contains "(" which is not allowed in a route config.`);
- expect(() => new ParamRoutePath('hi)'))
- .toThrowError(`Path "hi)" contains ")" which is not allowed in a route config.`);
- expect(() => new ParamRoutePath('hi//there'))
- .toThrowError(`Path "hi//there" contains "//" which is not allowed in a route config.`);
- });
-
- describe('querystring params', () => {
- it('should parse querystring params so long as the recognizer is a root', () => {
- var rec = new ParamRoutePath('/hello/there');
- var url = parser.parse('/hello/there?name=igor');
- var match = rec.matchUrl(url);
- expect(match.allParams).toEqual({'name': 'igor'});
- });
-
- it('should return a combined map of parameters with the param expected in the URL path',
- () => {
- var rec = new ParamRoutePath('/hello/:name');
- var url = parser.parse('/hello/paul?topic=success');
- var match = rec.matchUrl(url);
- expect(match.allParams).toEqual({'name': 'paul', 'topic': 'success'});
- });
- });
-
- describe('dynamic segments', () => {
- it('should parse parameters', () => {
- var rec = new ParamRoutePath('/test/:id');
- var url = new Url('test', new Url('abc'));
- var match = rec.matchUrl(url);
- expect(match.allParams).toEqual({'id': 'abc'});
- });
-
- it('should decode special characters when parsing', () => {
- var rec = new ParamRoutePath('/test/:id');
- var url = new Url('test', new Url('abc%25%2F%2f%28%29%3B'));
- var match = rec.matchUrl(url);
- expect(match.allParams).toEqual({'id': 'abc%//();'});
- });
-
- it('should generate url', () => {
- var rec = new ParamRoutePath('/test/:id');
- expect(rec.generateUrl({'id': 'abc'}).urlPath).toEqual('test/abc');
- });
-
- it('should encode special characters when generating', () => {
- var rec = new ParamRoutePath('/test/:id');
- expect(rec.generateUrl({'id': 'abc/def/%();'}).urlPath)
- .toEqual('test/abc%2Fdef%2F%25%28%29%3B');
- });
- });
-
- describe('matrix params', () => {
- it('should be parsed along with dynamic paths', () => {
- var rec = new ParamRoutePath('/hello/:id');
- var url = new Url('hello', new Url('matias', null, null, {'key': 'value'}));
- var match = rec.matchUrl(url);
- expect(match.allParams).toEqual({'id': 'matias', 'key': 'value'});
- });
-
- it('should be parsed on a static path', () => {
- var rec = new ParamRoutePath('/person');
- var url = new Url('person', null, null, {'name': 'dave'});
- var match = rec.matchUrl(url);
- expect(match.allParams).toEqual({'name': 'dave'});
- });
-
- it('should be ignored on a wildcard segment', () => {
- var rec = new ParamRoutePath('/wild/*everything');
- var url = parser.parse('/wild/super;variable=value');
- var match = rec.matchUrl(url);
- expect(match.allParams).toEqual({'everything': 'super;variable=value'});
- });
-
- it('should set matrix param values to true when no value is present', () => {
- var rec = new ParamRoutePath('/path');
- var url = new Url('path', null, null, {'one': true, 'two': true, 'three': '3'});
- var match = rec.matchUrl(url);
- expect(match.allParams).toEqual({'one': true, 'two': true, 'three': '3'});
- });
-
- it('should be parsed on the final segment of the path', () => {
- var rec = new ParamRoutePath('/one/two/three');
-
- var three = new Url('three', null, null, {'c': '3'});
- var two = new Url('two', three, null, {'b': '2'});
- var one = new Url('one', two, null, {'a': '1'});
-
- var match = rec.matchUrl(one);
- expect(match.allParams).toEqual({'c': '3'});
- });
- });
-
- describe('wildcard segment', () => {
- it('should return a url path which matches the original url path', () => {
- var rec = new ParamRoutePath('/wild/*everything');
- var url = parser.parse('/wild/super;variable=value/anotherPartAfterSlash');
- var match = rec.matchUrl(url);
- expect(match.urlPath).toEqual('wild/super;variable=value/anotherPartAfterSlash');
- });
- });
- });
-}
diff --git a/modules/@angular/router-deprecated/test/rules/route_paths/regex_route_param_spec.ts b/modules/@angular/router-deprecated/test/rules/route_paths/regex_route_param_spec.ts
deleted file mode 100644
index 816047c227..0000000000
--- a/modules/@angular/router-deprecated/test/rules/route_paths/regex_route_param_spec.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {beforeEach, ddescribe, describe, expect, iit, inject, it} from '@angular/core/testing/testing_internal';
-
-import {RegexRoutePath} from '../../../src/rules/route_paths/regex_route_path';
-import {GeneratedUrl} from '../../../src/rules/route_paths/route_path';
-import {parser} from '../../../src/url_parser';
-
-function emptySerializer(params: any /** TODO #9100 */) {
- return new GeneratedUrl('', {});
-}
-
-export function main() {
- describe('RegexRoutePath', () => {
-
- it('should throw when given an invalid regex',
- () => { expect(() => new RegexRoutePath('[abc', emptySerializer)).toThrowError(); });
-
- it('should parse a single param using capture groups', () => {
- var rec = new RegexRoutePath('^(.+)$', emptySerializer);
- var url = parser.parse('hello');
- var match = rec.matchUrl(url);
- expect(match.allParams).toEqual({'0': 'hello', '1': 'hello'});
- });
-
- it('should parse multiple params using capture groups', () => {
- var rec = new RegexRoutePath('^(.+)\\.(.+)$', emptySerializer);
- var url = parser.parse('hello.goodbye');
- var match = rec.matchUrl(url);
- expect(match.allParams).toEqual({'0': 'hello.goodbye', '1': 'hello', '2': 'goodbye'});
- });
-
- it('should generate a url by calling the provided serializer', () => {
- function serializer(params: any /** TODO #9100 */) {
- return new GeneratedUrl(`/a/${params['a']}/b/${params['b']}`, {});
- }
- var rec = new RegexRoutePath('/a/(.+)/b/(.+)$', serializer);
- var params = {a: 'one', b: 'two'};
- var url = rec.generateUrl(params);
- expect(url.urlPath).toEqual('/a/one/b/two');
- });
-
- it('should raise an error when the number of parameters doesnt match', () => {
- expect(() => {
- new RegexRoutePath('^a-([0-9]+)-b-([0-9]+)$', emptySerializer, ['complete_match', 'a']);
- }).toThrowError(`Regex group names [complete_match,a] must contain names for each matching \
-group and a name for the complete match as its first element of regex '^a-([0-9]+)-b-([0-9]+)$'. \
-3 group names are expected.`);
- });
-
- it('should take group naming into account when passing params', () => {
- var rec = new RegexRoutePath(
- '^a-([0-9]+)-b-([0-9]+)$', emptySerializer, ['complete_match', 'a', 'b']);
- var url = parser.parse('a-123-b-345');
- var match = rec.matchUrl(url);
- expect(match.allParams).toEqual({'complete_match': 'a-123-b-345', 'a': '123', 'b': '345'});
- });
- });
-}
diff --git a/modules/@angular/router-deprecated/test/rules/rule_set_spec.ts b/modules/@angular/router-deprecated/test/rules/rule_set_spec.ts
deleted file mode 100644
index da4a7b3248..0000000000
--- a/modules/@angular/router-deprecated/test/rules/rule_set_spec.ts
+++ /dev/null
@@ -1,268 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {AsyncTestCompleter, beforeEach, ddescribe, describe, iit, inject, it} from '@angular/core/testing/testing_internal';
-import {expect} from '@angular/platform-browser/testing/matchers';
-import {Redirect, Route} from '../../src/route_config/route_config_decorator';
-import {GeneratedUrl} from '../../src/rules/route_paths/route_path';
-import {RuleSet} from '../../src/rules/rule_set';
-import {PathMatch, RedirectMatch, RouteMatch} from '../../src/rules/rules';
-import {parser} from '../../src/url_parser';
-
-
-export function main() {
- describe('RuleSet', () => {
- var recognizer: RuleSet;
-
- beforeEach(() => { recognizer = new RuleSet(); });
-
-
- it('should recognize a static segment',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- recognizer.config(new Route({path: '/test', component: DummyCmpA}));
- recognize(recognizer, '/test').then((solutions: RouteMatch[]) => {
- expect(solutions.length).toBe(1);
- expect(getComponentType(solutions[0])).toEqual(DummyCmpA);
- async.done();
- });
- }));
-
-
- it('should recognize a single slash',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- recognizer.config(new Route({path: '/', component: DummyCmpA}));
- recognize(recognizer, '/').then((solutions: RouteMatch[]) => {
- expect(solutions.length).toBe(1);
- expect(getComponentType(solutions[0])).toEqual(DummyCmpA);
- async.done();
- });
- }));
-
-
- it('should recognize a dynamic segment',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- recognizer.config(new Route({path: '/user/:name', component: DummyCmpA}));
- recognize(recognizer, '/user/brian').then((solutions: RouteMatch[]) => {
- expect(solutions.length).toBe(1);
- expect(getComponentType(solutions[0])).toEqual(DummyCmpA);
- expect(getParams(solutions[0])).toEqual({'name': 'brian'});
- async.done();
- });
- }));
-
-
- it('should recognize a star segment',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- recognizer.config(new Route({path: '/first/*rest', component: DummyCmpA}));
- recognize(recognizer, '/first/second/third').then((solutions: RouteMatch[]) => {
- expect(solutions.length).toBe(1);
- expect(getComponentType(solutions[0])).toEqual(DummyCmpA);
- expect(getParams(solutions[0])).toEqual({'rest': 'second/third'});
- async.done();
- });
- }));
-
- it('should recognize a regex', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- function emptySerializer(params: any /** TODO #9100 */): GeneratedUrl {
- return new GeneratedUrl('', {});
- }
-
- recognizer.config(
- new Route({regex: '^(.+)/(.+)$', serializer: emptySerializer, component: DummyCmpA}));
- recognize(recognizer, '/first/second').then((solutions: RouteMatch[]) => {
- expect(solutions.length).toBe(1);
- expect(getComponentType(solutions[0])).toEqual(DummyCmpA);
- expect(getParams(solutions[0]))
- .toEqual({'0': 'first/second', '1': 'first', '2': 'second'});
- async.done();
- });
- }));
-
- it('should recognize a regex with named_groups',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- function emptySerializer(params: any /** TODO #9100 */): GeneratedUrl {
- return new GeneratedUrl('', {});
- }
-
- recognizer.config(new Route({
- regex: '^(.+)/(.+)$',
- regex_group_names: ['cc', 'a', 'b'],
- serializer: emptySerializer,
- component: DummyCmpA
- }));
- recognize(recognizer, '/first/second').then((solutions: RouteMatch[]) => {
- expect(solutions.length).toBe(1);
- expect(getComponentType(solutions[0])).toEqual(DummyCmpA);
- expect(getParams(solutions[0]))
- .toEqual({'cc': 'first/second', 'a': 'first', 'b': 'second'});
- async.done();
- });
- }));
-
-
-
- it('should throw when given two routes that start with the same static segment', () => {
- recognizer.config(new Route({path: '/hello', component: DummyCmpA}));
- expect(() => recognizer.config(new Route({path: '/hello', component: DummyCmpB})))
- .toThrowError('Configuration \'/hello\' conflicts with existing route \'/hello\'');
- });
-
-
- it('should throw when given two routes that have dynamic segments in the same order', () => {
- recognizer.config(new Route({path: '/hello/:person/how/:doyoudou', component: DummyCmpA}));
- expect(
- () => recognizer.config(
- new Route({path: '/hello/:friend/how/:areyou', component: DummyCmpA})))
- .toThrowError(
- 'Configuration \'/hello/:friend/how/:areyou\' conflicts with existing route \'/hello/:person/how/:doyoudou\'');
-
- expect(
- () => recognizer.config(
- new Redirect({path: '/hello/:pal/how/:goesit', redirectTo: ['/Foo']})))
- .toThrowError(
- 'Configuration \'/hello/:pal/how/:goesit\' conflicts with existing route \'/hello/:person/how/:doyoudou\'');
- });
-
-
- it('should recognize redirects', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- recognizer.config(new Route({path: '/b', component: DummyCmpA}));
- recognizer.config(new Redirect({path: '/a', redirectTo: ['B']}));
- recognize(recognizer, '/a').then((solutions: RouteMatch[]) => {
- expect(solutions.length).toBe(1);
- var solution = solutions[0];
- expect(solution).toBeAnInstanceOf(RedirectMatch);
- if (solution instanceof RedirectMatch) {
- expect(solution.redirectTo).toEqual(['B']);
- }
- async.done();
- });
- }));
-
-
- it('should generate URLs with params', () => {
- recognizer.config(new Route({path: '/app/user/:name', component: DummyCmpA, name: 'User'}));
- var instruction = recognizer.generate('User', {'name': 'misko'});
- expect(instruction.urlPath).toEqual('app/user/misko');
- });
-
-
- it('should generate URLs with numeric params', () => {
- recognizer.config(new Route({path: '/app/page/:number', component: DummyCmpA, name: 'Page'}));
- expect(recognizer.generate('Page', {'number': 42}).urlPath).toEqual('app/page/42');
- });
-
-
- it('should generate using a serializer', () => {
- function simpleSerializer(params: any /** TODO #9100 */): GeneratedUrl {
- var extra = {c: params['c']};
- return new GeneratedUrl(`/${params['a']}/${params['b']}`, extra);
- }
-
- recognizer.config(new Route({
- name: 'Route1',
- regex: '^(.+)/(.+)$',
- serializer: simpleSerializer,
- component: DummyCmpA
- }));
- var params = {a: 'first', b: 'second', c: 'third'};
- var result = recognizer.generate('Route1', params);
- expect(result.urlPath).toEqual('/first/second');
- expect(result.urlParams).toEqual(['c=third']);
- });
-
-
- it('should throw in the absence of required params URLs', () => {
- recognizer.config(new Route({path: 'app/user/:name', component: DummyCmpA, name: 'User'}));
- expect(() => recognizer.generate('User', {}))
- .toThrowError('Route generator for \'name\' was not included in parameters passed.');
- });
-
-
- it('should throw if the route alias is not TitleCase', () => {
- expect(
- () => recognizer.config(
- new Route({path: 'app/user/:name', component: DummyCmpA, name: 'user'})))
- .toThrowError(
- `Route "app/user/:name" with name "user" does not begin with an uppercase letter. Route names should be PascalCase like "User".`);
- });
-
-
- describe('params', () => {
- it('should recognize parameters within the URL path',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- recognizer.config(
- new Route({path: 'profile/:name', component: DummyCmpA, name: 'User'}));
- recognize(recognizer, '/profile/matsko?comments=all').then((solutions: RouteMatch[]) => {
- expect(solutions.length).toBe(1);
- expect(getParams(solutions[0])).toEqual({'name': 'matsko', 'comments': 'all'});
- async.done();
- });
- }));
-
-
- it('should generate and populate the given static-based route with querystring params',
- () => {
- recognizer.config(
- new Route({path: 'forum/featured', component: DummyCmpA, name: 'ForumPage'}));
-
- var params = {'start': 10, 'end': 100};
-
- var result = recognizer.generate('ForumPage', params);
- expect(result.urlPath).toEqual('forum/featured');
- expect(result.urlParams).toEqual(['start=10', 'end=100']);
- });
-
-
- it('should prefer positional params over query params',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- recognizer.config(
- new Route({path: 'profile/:name', component: DummyCmpA, name: 'User'}));
- recognize(recognizer, '/profile/yegor?name=igor').then((solutions: RouteMatch[]) => {
- expect(solutions.length).toBe(1);
- expect(getParams(solutions[0])).toEqual({'name': 'yegor'});
- async.done();
- });
- }));
-
-
- it('should ignore matrix params for the top-level component',
- inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
- recognizer.config(
- new Route({path: '/home/:subject', component: DummyCmpA, name: 'User'}));
- recognize(recognizer, '/home;sort=asc/zero;one=1?two=2')
- .then((solutions: RouteMatch[]) => {
- expect(solutions.length).toBe(1);
- expect(getParams(solutions[0])).toEqual({'subject': 'zero', 'two': '2'});
- async.done();
- });
- }));
- });
- });
-}
-
-function recognize(recognizer: RuleSet, url: string): Promise {
- var parsedUrl = parser.parse(url);
- return Promise.all(recognizer.recognize(parsedUrl));
-}
-
-function getComponentType(routeMatch: RouteMatch): any {
- if (routeMatch instanceof PathMatch) {
- return routeMatch.instruction.componentType;
- }
- return null;
-}
-
-function getParams(routeMatch: RouteMatch): any {
- if (routeMatch instanceof PathMatch) {
- return routeMatch.instruction.params;
- }
- return null;
-}
-
-class DummyCmpA {}
-class DummyCmpB {}
diff --git a/modules/@angular/router-deprecated/test/spies.ts b/modules/@angular/router-deprecated/test/spies.ts
deleted file mode 100644
index 8a5973484e..0000000000
--- a/modules/@angular/router-deprecated/test/spies.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Location} from '@angular/common';
-import {SpyObject, proxy} from '@angular/core/testing/testing_internal';
-import {Router, RouterOutlet} from '@angular/router-deprecated';
-
-export class SpyRouter extends SpyObject {
- constructor() { super(Router); }
-}
-
-export class SpyRouterOutlet extends SpyObject {
- constructor() { super(RouterOutlet); }
-}
-
-export class SpyLocation extends SpyObject {
- constructor() { super(Location); }
-}
-
-export class SpyPlatformLocation extends SpyObject {
- pathname: string = null;
- search: string = null;
- hash: string = null;
- constructor() { super(SpyPlatformLocation); }
-}
diff --git a/modules/@angular/router-deprecated/test/url_parser_spec.ts b/modules/@angular/router-deprecated/test/url_parser_spec.ts
deleted file mode 100644
index 264122c834..0000000000
--- a/modules/@angular/router-deprecated/test/url_parser_spec.ts
+++ /dev/null
@@ -1,133 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {beforeEach, ddescribe, describe, expect, iit, inject, it} from '@angular/core/testing/testing_internal';
-
-import {Url, UrlParser} from '../src/url_parser';
-
-
-export function main() {
- describe('ParsedUrl', () => {
- var urlParser: UrlParser;
-
- beforeEach(() => { urlParser = new UrlParser(); });
-
- it('should work in a simple case', () => {
- var url = urlParser.parse('hello/there');
- expect(url.toString()).toEqual('hello/there');
- });
-
- it('should remove the leading slash', () => {
- var url = urlParser.parse('/hello/there');
- expect(url.toString()).toEqual('hello/there');
- });
-
- it('should parse an empty URL', () => {
- var url = urlParser.parse('');
- expect(url.toString()).toEqual('');
- });
-
- it('should work with a single aux route', () => {
- var url = urlParser.parse('hello/there(a)');
- expect(url.toString()).toEqual('hello/there(a)');
- });
-
- it('should work with multiple aux routes', () => {
- var url = urlParser.parse('hello/there(a//b)');
- expect(url.toString()).toEqual('hello/there(a//b)');
- });
-
- it('should work with children after an aux route', () => {
- var url = urlParser.parse('hello/there(a//b)/c/d');
- expect(url.toString()).toEqual('hello/there(a//b)/c/d');
- });
-
- it('should work when aux routes have children', () => {
- var url = urlParser.parse('hello(aa/bb//bb/cc)');
- expect(url.toString()).toEqual('hello(aa/bb//bb/cc)');
- });
-
- it('should parse an aux route with an aux route', () => {
- var url = urlParser.parse('hello(aa(bb))');
- expect(url.toString()).toEqual('hello(aa(bb))');
- });
-
- it('should simplify an empty aux route definition', () => {
- var url = urlParser.parse('hello()/there');
- expect(url.toString()).toEqual('hello/there');
- });
-
- it('should parse a key-value matrix param', () => {
- var url = urlParser.parse('hello/friend;name=bob');
- expect(url.toString()).toEqual('hello/friend;name=bob');
- });
-
- it('should parse multiple key-value matrix params', () => {
- var url = urlParser.parse('hello/there;greeting=hi;whats=up');
- expect(url.toString()).toEqual('hello/there;greeting=hi;whats=up');
- });
-
- it('should ignore matrix params on the first segment', () => {
- var url = urlParser.parse('profile;a=1/hi');
- expect(url.toString()).toEqual('profile/hi');
- });
-
- it('should parse a key-only matrix param', () => {
- var url = urlParser.parse('hello/there;hi');
- expect(url.toString()).toEqual('hello/there;hi');
- });
-
- it('should parse a URL with just a query param', () => {
- var url = urlParser.parse('?name=bob');
- expect(url.toString()).toEqual('?name=bob');
- });
-
- it('should parse a key-value query param', () => {
- var url = urlParser.parse('hello/friend?name=bob');
- expect(url.toString()).toEqual('hello/friend?name=bob');
- });
-
- it('should parse multiple key-value query params', () => {
- var url = urlParser.parse('hello/there?greeting=hi&whats=up');
- expect(url.params).toEqual({'greeting': 'hi', 'whats': 'up'});
- expect(url.toString()).toEqual('hello/there?greeting=hi&whats=up');
- });
-
- it('should parse a key-only query param', () => {
- var url = urlParser.parse('hello/there?hi');
- expect(url.toString()).toEqual('hello/there?hi');
- });
-
- it('should parse a route with matrix and query params', () => {
- var url = urlParser.parse('hello/there;sort=asc;unfiltered?hi&friend=true');
- expect(url.toString()).toEqual('hello/there;sort=asc;unfiltered?hi&friend=true');
- });
-
- it('should parse a route with matrix params and aux routes', () => {
- var url = urlParser.parse('hello/there;sort=asc(modal)');
- expect(url.toString()).toEqual('hello/there;sort=asc(modal)');
- });
-
- it('should parse an aux route with matrix params', () => {
- var url = urlParser.parse('hello/there(modal;sort=asc)');
- expect(url.toString()).toEqual('hello/there(modal;sort=asc)');
- });
-
- it('should parse a route with matrix params, aux routes, and query params', () => {
- var url = urlParser.parse('hello/there;sort=asc(modal)?friend=true');
- expect(url.toString()).toEqual('hello/there;sort=asc(modal)?friend=true');
- });
- it('should allow slashes within query parameters', () => {
- var url = urlParser.parse(
- 'hello?code=4/B8o0n_Y7XZTb-pVKBw5daZyGAUbMljyLf7uNgTy6ja8&scope=https://www.googleapis.com/auth/analytics');
- expect(url.toString())
- .toEqual(
- 'hello?code=4/B8o0n_Y7XZTb-pVKBw5daZyGAUbMljyLf7uNgTy6ja8&scope=https://www.googleapis.com/auth/analytics');
- });
- });
-}
diff --git a/modules/@angular/router-deprecated/testing.ts b/modules/@angular/router-deprecated/testing.ts
deleted file mode 100644
index 1c6f455069..0000000000
--- a/modules/@angular/router-deprecated/testing.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-// future location of testing for router.
-export var __nothing__: any /** TODO #9100 */;
diff --git a/modules/@angular/router-deprecated/tsconfig-es2015.json b/modules/@angular/router-deprecated/tsconfig-es2015.json
deleted file mode 100644
index a2fc2b654b..0000000000
--- a/modules/@angular/router-deprecated/tsconfig-es2015.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "compilerOptions": {
- "baseUrl": ".",
- "declaration": true,
- "stripInternal": true,
- "experimentalDecorators": true,
- "module": "es2015",
- "moduleResolution": "node",
- "outDir": "../../../dist/packages-dist/router-deprecated/esm",
- "paths": {
- "@angular/core": ["../../../dist/packages-dist/core"],
- "@angular/common": ["../../../dist/packages-dist/common"],
- "@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"]
- },
- "rootDir": ".",
- "sourceMap": true,
- "inlineSources": true,
- "target": "es2015"
- },
- "files": [
- "index.ts",
- "testing.ts",
- "../../../node_modules/zone.js/dist/zone.js.d.ts"
- ]
-}
diff --git a/modules/@angular/router-deprecated/tsconfig-es5.json b/modules/@angular/router-deprecated/tsconfig-es5.json
deleted file mode 100644
index 4ed590d890..0000000000
--- a/modules/@angular/router-deprecated/tsconfig-es5.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "compilerOptions": {
- "baseUrl": ".",
- "declaration": true,
- "stripInternal": true,
- "experimentalDecorators": true,
- "module": "commonjs",
- "moduleResolution": "node",
- "outDir": "../../../dist/packages-dist/router-deprecated/",
- "paths": {
- "@angular/core": ["../../../dist/packages-dist/core"],
- "@angular/common": ["../../../dist/packages-dist/common"],
- "@angular/platform-browser": ["../../../dist/packages-dist/platform-browser/"]
- },
- "rootDir": ".",
- "sourceMap": true,
- "inlineSources": true,
- "lib": ["es6", "dom"],
- "target": "es5"
- },
- "files": [
- "index.ts",
- "testing.ts",
- "../../../node_modules/zone.js/dist/zone.js.d.ts"
- ]
-}
diff --git a/modules/playground/e2e_test/hash_routing/hash_location_spec.ts b/modules/playground/e2e_test/hash_routing/hash_location_spec.ts
deleted file mode 100644
index d6890d2b50..0000000000
--- a/modules/playground/e2e_test/hash_routing/hash_location_spec.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {verifyNoBrowserErrors} from 'e2e_util/e2e_util';
-
-function waitForElement(selector: any /** TODO #9100 */) {
- var EC = (protractor).ExpectedConditions;
- // Waits for the element with id 'abc' to be present on the dom.
- browser.wait(EC.presenceOf($(selector)), 20000);
-}
-
-describe('hash routing example app', function() {
- afterEach(verifyNoBrowserErrors);
-
- var URL = 'all/playground/src/hash_routing/index.html';
-
- it('should navigate between routes', function() {
- browser.get(URL + '#/bye');
- waitForElement('goodbye-cmp');
-
- element(by.css('#hello-link')).click();
- waitForElement('hello-cmp');
-
- expect(element(by.css('hello-cmp')).getText()).toContain('hello');
-
- browser.navigate().back();
- waitForElement('goodbye-cmp');
-
- expect(element(by.css('goodbye-cmp')).getText()).toContain('goodbye');
- });
-
-
- it('should open in new window if target is _blank', () => {
- var URL = 'all/playground/src/hash_routing/index.html';
- browser.get(URL + '#/');
- waitForElement('hello-cmp');
-
- element(by.css('#goodbye-link-blank')).click();
- expect(browser.driver.getCurrentUrl()).not.toContain('#/bye');
- browser.getAllWindowHandles().then(function(windows) {
- browser.switchTo().window(windows[1]).then(function() {
- expect(browser.driver.getCurrentUrl()).toContain('#/bye');
- });
- });
- });
-});
diff --git a/modules/playground/e2e_test/routing_deprecated/routing_deprecated_spec.ts b/modules/playground/e2e_test/routing_deprecated/routing_deprecated_spec.ts
deleted file mode 100644
index 72f43f5874..0000000000
--- a/modules/playground/e2e_test/routing_deprecated/routing_deprecated_spec.ts
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {verifyNoBrowserErrors} from 'e2e_util/e2e_util';
-
-function waitForElement(selector: any /** TODO #9100 */) {
- var EC = (protractor).ExpectedConditions;
- // Waits for the element with id 'abc' to be present on the dom.
- browser.wait(EC.presenceOf($(selector)), 20000);
-}
-
-describe('deprecated routing inbox-app', () => {
-
- afterEach(verifyNoBrowserErrors);
-
- describe('index view', () => {
- var URL = 'all/playground/src/routing_deprecated/';
-
- it('should list out the current collection of items', () => {
- browser.get(URL);
- waitForElement('.inbox-item-record');
- expect(element.all(by.css('.inbox-item-record')).count()).toEqual(200);
- });
-
- it('should build a link which points to the detail page', () => {
- browser.get(URL);
- waitForElement('#item-15');
- expect(element(by.css('#item-15')).getAttribute('href')).toMatch(/#\/detail\/15$/);
- element(by.css('#item-15')).click();
- waitForElement('#record-id');
- expect(browser.getCurrentUrl()).toMatch(/\/detail\/15$/);
- });
- });
-
-
- describe('drafts view', () => {
- var URL = 'all/playground/src/routing_deprecated/#/drafts';
-
- it('should navigate to the drafts view when the drafts link is clicked', () => {
- browser.get(URL);
- waitForElement('.inbox-item-record');
- element(by.linkText('Drafts')).click();
- waitForElement('.page-title');
- expect(element(by.css('.page-title')).getText()).toEqual('Drafts');
- });
-
- it('should navigate to email details', () => {
- browser.get(URL);
- element(by.linkText('Drafts')).click();
- waitForElement('.inbox-item-record');
- expect(element.all(by.css('.inbox-item-record')).count()).toEqual(2);
- expect(element(by.css('#item-201')).getAttribute('href')).toMatch(/#\/detail\/201$/);
- element(by.css('#item-201')).click();
- waitForElement('#record-id');
- expect(browser.getCurrentUrl()).toMatch(/\/detail\/201$/);
- });
- });
-
-
- describe('detail view', () => {
- var URL = 'all/playground/src/routing_deprecated/';
-
- it('should navigate to the detail view when an email is clicked', () => {
- browser.get(URL);
- waitForElement('#item-10');
- element(by.css('#item-10')).click();
- waitForElement('#record-id');
- var recordId = element(by.css('#record-id'));
- browser.wait(protractor.until.elementTextIs(recordId, 'ID: 10'), 5000);
- expect(recordId.getText()).toEqual('ID: 10');
- });
-
- it('should navigate back to the email inbox page when the back button is clicked', () => {
- browser.get(URL);
- waitForElement('#item-10');
- element(by.css('#item-10')).click();
- waitForElement('.back-button');
- element(by.css('.back-button')).click();
- expect(browser.getCurrentUrl()).toMatch(/\/$/);
- });
-
- it('should navigate back to index and sort the page items based on the provided querystring param',
- () => {
- browser.get(URL);
- waitForElement('#item-10');
- element(by.css('#item-10')).click();
- waitForElement('.sort-button');
- element(by.css('.sort-button')).click();
- expect(browser.getCurrentUrl()).toMatch(/\/#\?sort=date$/);
- waitForElement('.inbox-item-record');
- expect(element(by.css('.inbox-item-record > a')).getAttribute('id')).toEqual('item-137');
- });
- })
-});
diff --git a/modules/playground/src/hash_routing/index.html b/modules/playground/src/hash_routing/index.html
deleted file mode 100644
index 36cc7e8f4e..0000000000
--- a/modules/playground/src/hash_routing/index.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-Routing Example
-
-
-
- Loading...
-
-
-
-
-
diff --git a/modules/playground/src/hash_routing/index.ts b/modules/playground/src/hash_routing/index.ts
deleted file mode 100644
index 34adde17d2..0000000000
--- a/modules/playground/src/hash_routing/index.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {HashLocationStrategy, LocationStrategy} from '@angular/common';
-import {Component} from '@angular/core';
-import {bootstrap} from '@angular/platform-browser-dynamic';
-import {ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Route, RouteConfig} from '@angular/router-deprecated';
-
-
-@Component({selector: 'hello-cmp', template: `hello`})
-class HelloCmp {
-}
-
-
-@Component({selector: 'goodbye-cmp', template: `goodbye`})
-class GoodByeCmp {
-}
-
-
-@Component({
- selector: 'example-app',
- template: `
- My App
-
- Navigate via href |
- Navigate with Link DSL
-
- Navigate with Link DSL _blank target
-
-
-
- `,
- directives: [ROUTER_DIRECTIVES]
-})
-@RouteConfig([
- new Route({path: '/', component: HelloCmp, name: 'HelloCmp'}),
- new Route({path: '/bye', component: GoodByeCmp, name: 'GoodbyeCmp'})
-])
-class AppCmp {
-}
-
-
-export function main() {
- bootstrap(
- AppCmp, [ROUTER_PROVIDERS, {provide: LocationStrategy, useClass: HashLocationStrategy}]);
-}
diff --git a/modules/playground/src/routing_deprecated/app/data.ts b/modules/playground/src/routing_deprecated/app/data.ts
deleted file mode 100644
index 81ba71fc0c..0000000000
--- a/modules/playground/src/routing_deprecated/app/data.ts
+++ /dev/null
@@ -1,2124 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-export var data = [
- {
- 'id': '1',
- 'first-name': 'Montana',
- 'last-name': 'Prosacco',
- 'email': 'jairo.bergnaum@bergnaum.org',
- 'date': '1991-10-12 15:12:46 -0700',
- 'content':
- 'Et quisquam veniam voluptatem enim temporibus itaque. Ipsam voluptatem et. Occaecati rerum animi.',
- 'subject': 'Quidem quo ipsam architecto soluta numquam et'
- },
-
- {
- 'id': '2',
- 'first-name': 'Frances',
- 'last-name': 'Schaden',
- 'email': 'pierre_tromp@adams.com',
- 'date': '2001-05-06 08:22:33 -0700',
- 'content': 'Porro ea tempore numquam deserunt voluptas qui. Est quis suscipit.',
- 'subject': 'Voluptatibus dolore porro animi'
- },
-
- {
- 'id': '3',
- 'first-name': 'Jayne',
- 'last-name': 'Kreiger',
- 'email': 'breanne@howell.net',
- 'date': '2001-05-22 14:28:41 -0700',
- 'content': 'Voluptas et est laborum non ullam.',
- 'subject': 'Ratione ut illum fuga non'
- },
-
- {
- 'id': '4',
- 'first-name': 'Hester',
- 'last-name': 'Wyman',
- 'email': 'fausto@steuber.com',
- 'date': '1996-07-20 02:13:12 -0700',
- 'content':
- 'Iusto enim laborum. Autem sed quas laborum deserunt quibusdam dolorem. Laboriosam nesciunt debitis possimus ut aut quae.',
- 'subject': 'Ea quas et quia beatae dolores'
- },
-
- {
- 'id': '5',
- 'first-name': 'Alexandre',
- 'last-name': 'Dietrich',
- 'email': 'carmella_mante@moendibbert.biz',
- 'date': '2006-03-20 23:44:38 -0800',
- 'content': 'Voluptates voluptatem dolorem non quod dolores.',
- 'subject': 'Nostrum ad modi non consequatur repellendus et harum'
- },
-
- {
- 'id': '6',
- 'first-name': 'Ena',
- 'last-name': 'Green',
- 'email': 'jan_koepp@glover.name',
- 'date': '1988-03-21 02:00:36 -0800',
- 'content':
- 'Nam inventore voluptatum eaque ratione nisi nesciunt. Qui ex qui omnis aliquid. Dolorem ipsum expedita.',
- 'subject': 'Qui sint vero accusamus quam id vitae quis quia'
- },
-
- {
- 'id': '7',
- 'first-name': 'Rebecca',
- 'last-name': 'Walsh',
- 'email': 'marta@mueller.biz',
- 'date': '1974-05-09 02:40:20 -0700',
- 'content':
- 'Voluptas vel ut. Rerum vero repellat accusantium earum. Ea atque exercitationem expedita id dolores dolorem.',
- 'subject': 'Suscipit et inventore exercitationem ut voluptatum esse vero'
- },
-
- {
- 'id': '8',
- 'first-name': 'Jed',
- 'last-name': 'Rogahn',
- 'email': 'talia_crist@mertzfadel.info',
- 'date': '2006-10-17 01:28:46 -0700',
- 'content': 'Cupiditate nam blanditiis.',
- 'subject': 'Dolore nulla qui sequi ut enim sed'
- },
-
- {
- 'id': '9',
- 'first-name': 'Fabiola',
- 'last-name': 'Olson',
- 'email': 'henderson@casper.org',
- 'date': '2008-02-29 11:46:44 -0800',
- 'content':
- 'Similique nesciunt omnis beatae omnis pariatur quas. Voluptatem eum consequatur id impedit fugit dignissimos ut.',
- 'subject': 'Sit quasi accusamus aut et eum'
- },
-
- {
- 'id': '10',
- 'first-name': 'Alex',
- 'last-name': 'Turcotte',
- 'email': 'mya@stokes.org',
- 'date': '1974-03-29 12:02:53 -0700',
- 'content':
- 'Ut pariatur porro maiores. Saepe soluta aspernatur est sed suscipit. Excepturi incidunt aut atque nostrum cum non.',
- 'subject': 'Rerum dolore sunt veniam provident'
- },
-
- {
- 'id': '11',
- 'first-name': 'Jerome',
- 'last-name': 'Greenholt',
- 'email': 'jazmyne.dibbert@abshire.org',
- 'date': '1997-01-12 02:48:08 -0800',
- 'content': 'Natus error id.',
- 'subject': 'Rerum nemo aperiam veritatis veniam'
- },
-
- {
- 'id': '12',
- 'first-name': 'Antwan',
- 'last-name': 'Kreiger',
- 'email': 'delilah@dibbert.name',
- 'date': '1971-05-08 10:45:01 -0700',
- 'content':
- 'Perspiciatis sed quo. Eum dignissimos quia expedita dolorem illum minima enim. Fugiat ducimus nostrum quia reiciendis autem nisi placeat.',
- 'subject': 'Esse ipsum pariatur voluptatum rerum labore id odit'
- },
-
- {
- 'id': '13',
- 'first-name': 'Kyleigh',
- 'last-name': 'Rogahn',
- 'email': 'ralph_ledner@bartolettifay.info',
- 'date': '2013-11-28 16:10:15 -0800',
- 'content': 'Molestias repudiandae dicta vel.',
- 'subject': 'Facilis occaecati pariatur qui incidunt reprehenderit sunt'
- },
-
- {
- 'id': '14',
- 'first-name': 'Henriette',
- 'last-name': 'Gottlieb',
- 'email': 'adeline.rowe@lubowitz.net',
- 'date': '1983-02-11 06:45:49 -0800',
- 'content': 'Eveniet ut voluptas eos ut rerum voluptatum.',
- 'subject': 'Natus voluptas voluptatem alias'
- },
-
- {
- 'id': '15',
- 'first-name': 'Jacklyn',
- 'last-name': 'White',
- 'email': 'milton_keebler@braun.biz',
- 'date': '1992-01-07 12:27:59 -0800',
- 'content': 'Reiciendis et aperiam. Doloremque totam repudiandae velit fuga fugiat.',
- 'subject': 'Nulla est magnam ducimus porro commodi'
- },
-
- {
- 'id': '16',
- 'first-name': 'Charlotte',
- 'last-name': 'Ziemann',
- 'email': 'brett@purdymills.com',
- 'date': '1972-06-06 02:42:50 -0700',
- 'content':
- 'Voluptatem corporis tempore. Consectetur fugit perspiciatis libero dolore consequatur asperiores. Voluptates ea accusamus.',
- 'subject': 'Ea adipisci reiciendis excepturi suscipit necessitatibus ut sed'
- },
-
- {
- 'id': '17',
- 'first-name': 'Giovanny',
- 'last-name': 'Runolfsdottir',
- 'email': 'dustin.sanford@rippin.com',
- 'date': '1987-04-14 19:29:11 -0700',
- 'content':
- 'Dolor consequuntur sed aspernatur qui. Sit cumque id animi ut sed id. Asperiores voluptatem similique voluptas.',
- 'subject': 'Id ut voluptatum culpa molestiae quo'
- },
-
- {
- 'id': '18',
- 'first-name': 'Savion',
- 'last-name': 'McCullough',
- 'email': 'don@gorczanysimonis.name',
- 'date': '1974-01-18 14:40:40 -0700',
- 'content':
- 'Autem voluptatem dignissimos vel debitis ipsum voluptatem consequuntur. Voluptatum et saepe.',
- 'subject': 'Ipsa similique quo nostrum'
- },
-
- {
- 'id': '19',
- 'first-name': 'Robbie',
- 'last-name': 'Kohler',
- 'email': 'haley@waters.biz',
- 'date': '2002-09-28 08:35:10 -0700',
- 'content':
- 'Quo ut accusantium similique necessitatibus. Sunt impedit commodi ut et odit voluptatibus error.',
- 'subject': 'Voluptate eum quo error'
- },
-
- {
- 'id': '20',
- 'first-name': 'Eulalia',
- 'last-name': 'Effertz',
- 'email': 'rodrigo_parisian@bergecartwright.net',
- 'date': '2006-07-29 21:47:56 -0700',
- 'content':
- 'Eum repudiandae rem aliquid dolorum suscipit vel. Autem vel voluptas et iure magni.',
- 'subject': 'Est dolorum modi et error consequuntur qui'
- },
-
- {
- 'id': '21',
- 'first-name': 'Gregoria',
- 'last-name': 'Boehm',
- 'email': 'miles@jerde.org',
- 'date': '1997-04-11 19:49:38 -0700',
- 'content':
- 'Qui necessitatibus veniam. Maiores impedit in natus aspernatur adipisci. Ad sapiente iste.',
- 'subject': 'Doloribus ipsum a eius voluptatem nulla'
- },
-
- {
- 'id': '22',
- 'first-name': 'Berry',
- 'last-name': 'Collier',
- 'email': 'larry_rath@rathbernier.info',
- 'date': '1981-06-26 05:26:47 -0700',
- 'content':
- 'Numquam rerum quia similique enim sequi eos inventore. Numquam inventore aliquam commodi neque maiores. Hic et vel aut velit corrupti.',
- 'subject': 'Optio ab delectus pariatur vel tempore'
- },
-
- {
- 'id': '23',
- 'first-name': 'Crawford',
- 'last-name': 'Ryan',
- 'email': 'cindy_ziemann@harvey.org',
- 'date': '1997-06-12 07:56:32 -0700',
- 'content': 'Odio ea nostrum molestiae. Doloribus ducimus occaecati facilis pariatur ut est.',
- 'subject': 'Quo fugit at totam voluptate est'
- },
-
- {
- 'id': '24',
- 'first-name': 'Kelsie',
- 'last-name': 'Stokes',
- 'email': 'jackson_ferry@connelly.name',
- 'date': '1986-07-30 21:39:50 -0700',
- 'content':
- 'Amet voluptatem ea nesciunt sunt. Quidem pariatur sit. Minus aliquam itaque laudantium in quibusdam laboriosam.',
- 'subject': 'Labore voluptas dolor repellendus accusantium tempora'
- },
-
- {
- 'id': '25',
- 'first-name': 'Josefa',
- 'last-name': 'Predovic',
- 'email': 'moises@sauer.info',
- 'date': '1976-04-09 22:38:31 -0800',
- 'content':
- 'Aliquam consectetur et non soluta. Quia dolore molestiae facilis eos nihil vel. Quidem eos et.',
- 'subject': 'Qui architecto inventore alias non aut dolorum porro'
- },
-
- {
- 'id': '26',
- 'first-name': 'Toby',
- 'last-name': 'Wehner',
- 'email': 'janet@mohr.org',
- 'date': '2003-05-08 07:44:26 -0700',
- 'content': 'Suscipit cumque alias debitis necessitatibus et qui.',
- 'subject': 'Possimus laudantium exercitationem ut deleniti similique'
- },
-
- {
- 'id': '27',
- 'first-name': 'Keira',
- 'last-name': 'Stamm',
- 'email': 'karlie@witting.info',
- 'date': '2010-11-11 16:17:29 -0800',
- 'content':
- 'Rerum cum at autem repellat quod nihil. Quasi voluptates minus autem accusantium debitis cumque qui.',
- 'subject': 'Nostrum repudiandae voluptatum adipisci ut error sunt et sint'
- },
-
- {
- 'id': '28',
- 'first-name': 'Clark',
- 'last-name': 'Predovic',
- 'email': 'palma@ankundingbednar.biz',
- 'date': '1978-02-10 16:55:54 -0800',
- 'content':
- 'Non ex aperiam porro. At harum vitae ut exercitationem qui qui. Quae sed sapiente sed debitis officiis quis unde.',
- 'subject': 'Eos eligendi voluptatum consequatur reprehenderit'
- },
-
- {
- 'id': '29',
- 'first-name': 'Colby',
- 'last-name': 'Jacobson',
- 'email': 'rozella@spencer.com',
- 'date': '1978-01-04 00:18:51 -0800',
- 'content':
- 'Molestiae laudantium voluptas ipsa est laborum vel. Dolorem et est nihil distinctio numquam.',
- 'subject': 'Aut et sint deleniti mollitia debitis'
- },
-
- {
- 'id': '30',
- 'first-name': 'Kayley',
- 'last-name': 'Connelly',
- 'email': 'rowland.thiel@gutmannorn.info',
- 'date': '2012-12-10 09:59:08 -0800',
- 'content':
- 'Eligendi quia repellat distinctio eum voluptas debitis. Totam a alias qui voluptates dolor.',
- 'subject': 'Ipsum consequatur culpa repellat quae mollitia quia unde'
- },
-
- {
- 'id': '31',
- 'first-name': 'Kay',
- 'last-name': 'Reynolds',
- 'email': 'lexie.frami@beattyschoen.info',
- 'date': '1991-05-27 22:37:41 -0700',
- 'content':
- 'Laborum quod iusto in voluptas et adipisci dolor. Totam et voluptatibus id tempora. Asperiores magnam dolorem quo iste sapiente.',
- 'subject': 'Tempora et eligendi quia dolorem alias ullam maiores doloremque'
- },
-
- {
- 'id': '32',
- 'first-name': 'Ellsworth',
- 'last-name': 'Veum',
- 'email': 'estefania_hermann@murray.biz',
- 'date': '1974-12-07 03:43:52 -0800',
- 'content':
- 'Et commodi molestiae hic distinctio et iusto. Quod illo natus unde est aut. Laborum rem rerum totam.',
- 'subject': 'Expedita nostrum consectetur sint velit modi maxime quisquam'
- },
-
- {
- 'id': '33',
- 'first-name': 'Adeline',
- 'last-name': 'Altenwerth',
- 'email': 'francesco@weberstroman.com',
- 'date': '1988-03-25 22:52:39 -0800',
- 'content':
- 'Quod deserunt eum dignissimos eius et veniam. Non exercitationem omnis molestiae corrupti aliquid commodi repudiandae.',
- 'subject': 'Dolor incidunt debitis possimus temporibus rerum quibusdam eaque'
- },
-
- {
- 'id': '34',
- 'first-name': 'River',
- 'last-name': 'Roob',
- 'email': 'lester.hodkiewicz@hoppemcglynn.name',
- 'date': '1981-01-03 06:04:53 -0800',
- 'content':
- 'Sed dolorem et laborum voluptate perspiciatis doloremque aliquam. Recusandae et odit. Sit esse consequatur occaecati fuga sed.',
- 'subject': 'Dolorem ut quia repudiandae accusamus reprehenderit dignissimos iste cupiditate'
- },
-
- {
- 'id': '35',
- 'first-name': 'Chaya',
- 'last-name': 'Stokes',
- 'email': 'rebekah.baumbach@toy.org',
- 'date': '1979-09-03 07:52:52 -0700',
- 'content': 'Ea voluptas minus hic omnis.',
- 'subject': 'Ab repellendus quia eos eius'
- },
-
- {
- 'id': '36',
- 'first-name': 'Cara',
- 'last-name': 'Brown',
- 'email': 'natasha_gibson@bins.name',
- 'date': '1985-12-19 03:29:37 -0800',
- 'content':
- 'Numquam nobis consectetur modi eligendi. Facere adipisci aut velit quis dolor quidem totam. Consequatur qui placeat aut molestiae dignissimos.',
- 'subject': 'Est quia reiciendis enim et totam temporibus'
- },
-
- {
- 'id': '37',
- 'first-name': 'Laron',
- 'last-name': 'Wunsch',
- 'email': 'erna@heathcote.com',
- 'date': '2004-06-28 16:53:07 -0700',
- 'content':
- 'Quisquam maxime nostrum explicabo corrupti ut. Et accusantium culpa occaecati officiis quo.',
- 'subject': 'Et et nulla aspernatur quas distinctio'
- },
-
- {
- 'id': '38',
- 'first-name': 'Lessie',
- 'last-name': 'Roob',
- 'email': 'ona_olson@dicki.biz',
- 'date': '1980-02-10 00:18:48 -0800',
- 'content':
- 'Facere veritatis aut quam praesentium ut. Consectetur praesentium explicabo consequuntur quia vel rem.',
- 'subject': 'Tenetur ducimus mollitia consequatur dicta'
- },
-
- {
- 'id': '39',
- 'first-name': 'Felton',
- 'last-name': 'Labadie',
- 'email': 'stone.kihn@vonruedenbartoletti.biz',
- 'date': '2002-04-04 17:29:31 -0800',
- 'content':
- 'Iure ad nesciunt. Excepturi impedit eum suscipit dignissimos est. Corrupti accusamus sapiente ratione eaque iure aut mollitia.',
- 'subject': 'Sunt et eius et iusto accusamus voluptas eum'
- },
-
- {
- 'id': '40',
- 'first-name': 'Verna',
- 'last-name': 'Hoppe',
- 'email': 'arthur_schiller@daniel.org',
- 'date': '2013-05-15 16:04:25 -0700',
- 'content':
- 'Veniam quia omnis at sapiente. Est est fugit eum. Impedit suscipit hic similique eum quibusdam.',
- 'subject': 'Voluptatum ipsum libero et vitae odio dolore tenetur perspiciatis'
- },
-
- {
- 'id': '41',
- 'first-name': 'Velda',
- 'last-name': 'Veum',
- 'email': 'christy@feil.org',
- 'date': '1988-10-24 12:42:25 -0700',
- 'content': 'Rem inventore necessitatibus iste et quia vero laudantium.',
- 'subject': 'Suscipit similique provident officia est explicabo sed'
- },
-
- {
- 'id': '42',
- 'first-name': 'Mackenzie',
- 'last-name': 'Schroeder',
- 'email': 'miles.dietrich@stehrkuhic.org',
- 'date': '1990-01-07 22:38:09 -0800',
- 'content': 'Non autem delectus. Architecto recusandae unde quia rerum inventore repudiandae.',
- 'subject': 'Molestiae odio et repudiandae ut'
- },
-
- {
- 'id': '43',
- 'first-name': 'Natalie',
- 'last-name': 'Hoeger',
- 'email': 'gregorio_mosciski@schneiderframi.net',
- 'date': '1976-04-06 06:23:07 -0800',
- 'content':
- 'Iste id illo cupiditate enim aut quo. Vel ut eos qui. Aut at in eum maiores voluptatem quidem.',
- 'subject': 'Quia officiis sit sint aliquid ad quibusdam et'
- },
-
- {
- 'id': '44',
- 'first-name': 'Joan',
- 'last-name': 'Mosciski',
- 'email': 'thad@dickivolkman.info',
- 'date': '1990-12-26 15:04:40 -0800',
- 'content': 'Culpa est officia veritatis esse.',
- 'subject': 'Est eum ullam quo'
- },
-
- {
- 'id': '45',
- 'first-name': 'Emmitt',
- 'last-name': 'Keeling',
- 'email': 'cali@ferry.info',
- 'date': '2009-04-10 10:14:57 -0700',
- 'content':
- 'Numquam velit sunt sed et ut. Laudantium qui laboriosam quibusdam qui. Odio non maxime soluta vero qui.',
- 'subject': 'Accusantium saepe id totam aut reiciendis at esse magnam'
- },
-
- {
- 'id': '46',
- 'first-name': 'Guy',
- 'last-name': 'Renner',
- 'email': 'naomie_klein@streich.name',
- 'date': '1970-12-18 13:09:51 -0800',
- 'content': 'Iure quia at excepturi sit consequatur.',
- 'subject': 'Commodi aut ipsa accusantium dolor repudiandae in'
- },
-
- {
- 'id': '47',
- 'first-name': 'Eric',
- 'last-name': 'Kihn',
- 'email': 'dock.schmeler@langworth.biz',
- 'date': '1993-12-17 11:17:07 -0800',
- 'content': 'Facere voluptate omnis qui officia dicta.',
- 'subject': 'Incidunt a libero ab asperiores fuga ut quo illum'
- },
-
- {
- 'id': '48',
- 'first-name': 'Kraig',
- 'last-name': 'Keeling',
- 'email': 'alejandrin@streichwiegand.org',
- 'date': '1977-12-09 14:54:22 -0800',
- 'content': 'Asperiores expedita incidunt in cum ex vel hic.',
- 'subject': 'In illum quisquam ut est eligendi aut'
- },
-
- {
- 'id': '49',
- 'first-name': 'Justice',
- 'last-name': 'Leuschke',
- 'email': 'florencio@conn.info',
- 'date': '1991-12-14 09:38:08 -0800',
- 'content':
- 'Aspernatur nesciunt voluptas sit. Cum architecto enim et blanditiis soluta dolor. Recusandae numquam occaecati esse animi et aut.',
- 'subject': 'Quaerat voluptatibus eum sapiente iure deserunt'
- },
-
- {
- 'id': '50',
- 'first-name': 'Jodie',
- 'last-name': 'O\'Hara',
- 'email': 'rick@stehrboehm.info',
- 'date': '2000-07-21 05:34:03 -0700',
- 'content':
- 'Labore repudiandae dolor nostrum quo tempora eos. Natus ea fugit voluptas doloremque distinctio quaerat unde. Ut aut nostrum.',
- 'subject': 'Tempore in quam id aliquam fuga eos dolor'
- },
-
- {
- 'id': '51',
- 'first-name': 'Dannie',
- 'last-name': 'Vandervort',
- 'email': 'mariana@abbottruecker.biz',
- 'date': '2001-09-15 19:00:54 -0700',
- 'content': 'Consectetur dolore voluptas.',
- 'subject': 'Tenetur possimus et fuga mollitia perferendis omnis corporis'
- },
-
- {
- 'id': '52',
- 'first-name': 'Delaney',
- 'last-name': 'Champlin',
- 'email': 'kyler_welch@krisrowe.biz',
- 'date': '2014-07-22 07:09:07 -0700',
- 'content': 'Voluptates qui aut.',
- 'subject': 'Quam eos laborum nisi delectus'
- },
-
- {
- 'id': '53',
- 'first-name': 'Barbara',
- 'last-name': 'Kihn',
- 'email': 'tyrese.casper@keebler.net',
- 'date': '1996-02-29 20:04:40 -0800',
- 'content': 'Totam labore voluptatem eos qui temporibus velit.',
- 'subject': 'Eum neque sed aut sunt'
- },
-
- {
- 'id': '54',
- 'first-name': 'Jarred',
- 'last-name': 'Shanahan',
- 'email': 'coralie@weinat.net',
- 'date': '1977-06-08 01:46:22 -0700',
- 'content': 'Sed et voluptatum ut est quo et aut.',
- 'subject': 'Aut eligendi voluptas mollitia et accusamus sint nemo'
- },
-
- {
- 'id': '55',
- 'first-name': 'Llewellyn',
- 'last-name': 'Bechtelar',
- 'email': 'kaci@jast.com',
- 'date': '1998-12-01 21:14:32 -0800',
- 'content': 'Architecto eligendi et ut occaecati temporibus voluptas quia.',
- 'subject': 'Sint quis vitae voluptatem dolor aut quo maiores quas'
- },
-
- {
- 'id': '56',
- 'first-name': 'Albertha',
- 'last-name': 'Upton',
- 'email': 'august@bradtkemiller.net',
- 'date': '2006-11-16 14:38:45 -0800',
- 'content':
- 'Voluptas perspiciatis recusandae et. Sequi eum eius dicta dolorem. Alias reprehenderit explicabo doloribus exercitationem sint.',
- 'subject': 'Quo nihil fuga dolores cumque rerum eos asperiores'
- },
-
- {
- 'id': '57',
- 'first-name': 'Christy',
- 'last-name': 'Considine',
- 'email': 'eliseo@veum.com',
- 'date': '1997-05-17 13:54:41 -0700',
- 'content':
- 'Consequatur rerum laudantium distinctio magni. Iusto ullam et suscipit nemo ex velit voluptatem.',
- 'subject': 'Ut ea quisquam libero qui repudiandae aut officia'
- },
-
- {
- 'id': '58',
- 'first-name': 'Jessica',
- 'last-name': 'Simonis',
- 'email': 'rickey@mertz.info',
- 'date': '2012-10-04 00:32:34 -0700',
- 'content':
- 'Neque tenetur sunt sunt ratione. Rerum dolorem illo ab blanditiis quisquam architecto. Quidem ea exercitationem enim eos.',
- 'subject': 'Atque quo nemo explicabo voluptas blanditiis accusantium et'
- },
-
- {
- 'id': '59',
- 'first-name': 'Justen',
- 'last-name': 'Davis',
- 'email': 'karen@jaskolskigleason.org',
- 'date': '1994-08-10 02:33:43 -0700',
- 'content': 'Eius tenetur mollitia ad alias ab.',
- 'subject': 'Ut accusantium sunt qui nostrum eligendi'
- },
-
- {
- 'id': '60',
- 'first-name': 'Elwin',
- 'last-name': 'Daugherty',
- 'email': 'milo@ko.net',
- 'date': '1976-06-30 05:16:38 -0700',
- 'content': 'Sit necessitatibus minus.',
- 'subject': 'A molestiae voluptates ducimus id est recusandae'
- },
-
- {
- 'id': '61',
- 'first-name': 'Clair',
- 'last-name': 'Raynor',
- 'email': 'zella.hermiston@batz.org',
- 'date': '1985-12-18 14:30:18 -0800',
- 'content': 'Aut aliquid est sit pariatur voluptatem dolorum.',
- 'subject': 'Consectetur reprehenderit temporibus vel voluptatem voluptatem et rem fuga'
- },
-
- {
- 'id': '62',
- 'first-name': 'Hilario',
- 'last-name': 'Klein',
- 'email': 'adrain@stark.biz',
- 'date': '1980-09-08 18:06:43 -0700',
- 'content': 'Eum dolore optio quos animi.',
- 'subject': 'Illum nihil vitae molestiae laboriosam beatae modi'
- },
-
- {
- 'id': '63',
- 'first-name': 'Greta',
- 'last-name': 'Murray',
- 'email': 'ethelyn@fritsch.org',
- 'date': '1970-05-23 02:27:54 -0700',
- 'content':
- 'Quisquam animi et recusandae rem modi eos ipsa. Eaque et expedita qui animi veritatis temporibus.',
- 'subject': 'Repellendus fuga sint nemo'
- },
-
- {
- 'id': '64',
- 'first-name': 'Anissa',
- 'last-name': 'Adams',
- 'email': 'edward@armstrong.com',
- 'date': '1997-01-26 22:21:57 -0800',
- 'content': 'Laudantium culpa rem voluptas tempore. Sit modi dolor est sunt rem.',
- 'subject': 'Autem unde minima quia beatae totam'
- },
-
- {
- 'id': '65',
- 'first-name': 'Kaylah',
- 'last-name': 'Conroy',
- 'email': 'brian.cormier@hyatt.org',
- 'date': '2015-02-02 07:44:37 -0800',
- 'content': 'Voluptates vitae nulla expedita. Possimus et quo aut eum.',
- 'subject': 'Molestiae minus enim adipisci et'
- },
-
- {
- 'id': '66',
- 'first-name': 'Jamey',
- 'last-name': 'Ebert',
- 'email': 'seth@pfannerstillrodriguez.name',
- 'date': '1987-09-29 09:40:59 -0700',
- 'content': 'Voluptatem est quae.',
- 'subject': 'Similique nemo placeat id tempore dolorum'
- },
-
- {
- 'id': '67',
- 'first-name': 'Johnson',
- 'last-name': 'Mosciski',
- 'email': 'morton@littel.net',
- 'date': '1989-02-14 11:15:10 -0800',
- 'content':
- 'Molestias expedita exercitationem et praesentium et vel delectus. Qui fuga molestias porro.',
- 'subject': 'Aut rerum quidem est iste in blanditiis sit'
- },
-
- {
- 'id': '68',
- 'first-name': 'Ellis',
- 'last-name': 'O\'Keefe',
- 'email': 'taurean@ullrich.biz',
- 'date': '1987-03-09 11:29:05 -0800',
- 'content':
- 'Facere sint doloribus qui illo autem consequatur culpa. Est quisquam enim accusantium praesentium.',
- 'subject': 'Quis beatae quia velit deserunt est sit odit quisquam'
- },
-
- {
- 'id': '69',
- 'first-name': 'Marlen',
- 'last-name': 'Ritchie',
- 'email': 'rodger_schamberger@thiel.net',
- 'date': '1989-07-23 03:03:52 -0700',
- 'content': 'Doloribus porro hic quis explicabo fuga veritatis vero.',
- 'subject': 'Et doloribus est consequatur unde'
- },
-
- {
- 'id': '70',
- 'first-name': 'Maddison',
- 'last-name': 'Kuhic',
- 'email': 'rosetta@von.biz',
- 'date': '1975-06-22 10:34:58 -0700',
- 'content':
- 'Sit ut eos libero error sapiente veritatis. Est dolore qui impedit recusandae quas animi rerum.',
- 'subject': 'Quos culpa assumenda enim eius aliquid dolorum'
- },
-
- {
- 'id': '71',
- 'first-name': 'Whitney',
- 'last-name': 'Parisian',
- 'email': 'everardo@langworth.name',
- 'date': '1970-11-04 01:17:28 -0800',
- 'content':
- 'Quam dolores pariatur ut possimus. Alias tenetur ex accusantium quasi. Nihil dolorem mollitia quidem.',
- 'subject': 'Officia totam excepturi sed illum et tempore commodi sit'
- },
-
- {
- 'id': '72',
- 'first-name': 'Madyson',
- 'last-name': 'Streich',
- 'email': 'imani@murray.biz',
- 'date': '1983-07-16 11:27:34 -0700',
- 'content':
- 'Veritatis molestiae id placeat dolorem consectetur a est. Est enim aut. Magnam aut distinctio quo sapiente ea est accusantium.',
- 'subject': 'Aut sunt esse eligendi et qui ut sed'
- },
-
- {
- 'id': '73',
- 'first-name': 'Laurie',
- 'last-name': 'Purdy',
- 'email': 'jarrell@paucek.biz',
- 'date': '1992-10-18 12:48:31 -0700',
- 'content':
- 'Saepe facilis est repellendus praesentium autem. Qui soluta voluptas ullam sequi. Molestias aut quibusdam.',
- 'subject': 'Quo ullam totam sit dolores'
- },
-
- {
- 'id': '74',
- 'first-name': 'Ollie',
- 'last-name': 'Lowe',
- 'email': 'corene@kris.info',
- 'date': '1976-08-24 16:28:46 -0700',
- 'content': 'Nostrum qui eaque aperiam possimus libero non. Quae aut enim non.',
- 'subject': 'Optio minus aut officiis voluptates reiciendis sit dicta'
- },
-
- {
- 'id': '75',
- 'first-name': 'Ian',
- 'last-name': 'Murray',
- 'email': 'adelia_bernhard@maggio.com',
- 'date': '1982-04-08 00:25:22 -0800',
- 'content': 'Quod dolores quibusdam nihil aut vel. Sit ab vitae necessitatibus eum.',
- 'subject': 'Quia praesentium nam debitis nulla repellendus quos'
- },
-
- {
- 'id': '76',
- 'first-name': 'Bernard',
- 'last-name': 'Zieme',
- 'email': 'kaelyn.johnson@markswalsh.net',
- 'date': '2014-01-17 03:47:35 -0800',
- 'content': 'Repellendus qui reiciendis quibusdam voluptatum voluptate omnis.',
- 'subject': 'Mollitia ut omnis tempore aut debitis ratione alias illum'
- },
-
- {
- 'id': '77',
- 'first-name': 'Megane',
- 'last-name': 'Kuvalis',
- 'email': 'otis@donnellypouros.name',
- 'date': '1987-09-29 22:10:00 -0700',
- 'content':
- 'Explicabo repellat qui placeat inventore velit. Tempora accusamus minima facilis dicta architecto unde. Excepturi enim eos.',
- 'subject': 'Quam molestias amet officiis'
- },
-
- {
- 'id': '78',
- 'first-name': 'Freeman',
- 'last-name': 'Nader',
- 'email': 'samara_hoppe@dachcorkery.info',
- 'date': '2009-02-02 12:08:30 -0800',
- 'content': 'Perferendis aut minus in.',
- 'subject': 'Voluptates odio neque laudantium accusamus ipsa accusantium'
- },
-
- {
- 'id': '79',
- 'first-name': 'Margarita',
- 'last-name': 'Heller',
- 'email': 'heloise@rogahn.name',
- 'date': '1984-01-04 10:41:32 -0800',
- 'content': 'Officiis voluptas omnis. Nihil consectetur id reiciendis qui nemo est.',
- 'subject': 'Velit in molestias quo repudiandae accusamus et excepturi et'
- },
-
- {
- 'id': '80',
- 'first-name': 'Lonny',
- 'last-name': 'Goodwin',
- 'email': 'darian@kundebernier.info',
- 'date': '1999-02-08 07:00:38 -0800',
- 'content':
- 'Earum provident et minima aliquam iusto sint. Sed numquam ducimus voluptatem quos enim.',
- 'subject': 'Commodi beatae vitae aut quos dolor consequatur'
- },
-
- {
- 'id': '81',
- 'first-name': 'Jazlyn',
- 'last-name': 'Bayer',
- 'email': 'harvey@rempel.org',
- 'date': '2009-09-28 16:50:32 -0700',
- 'content': 'Ipsum voluptas perferendis aperiam dolor.',
- 'subject': 'Omnis inventore nobis cupiditate quas quis tenetur'
- },
-
- {
- 'id': '82',
- 'first-name': 'Jakob',
- 'last-name': 'Conn',
- 'email': 'rylee@vandervort.net',
- 'date': '2008-11-12 17:22:34 -0800',
- 'content':
- 'Aut temporibus perferendis neque nulla et. Totam ab neque inventore et facere eligendi.',
- 'subject': 'A optio ut molestiae iste et nam'
- },
-
- {
- 'id': '83',
- 'first-name': 'Mikayla',
- 'last-name': 'Romaguera',
- 'email': 'rebecca_moriette@stracke.net',
- 'date': '1986-08-09 12:39:31 -0700',
- 'content': 'Dicta et reiciendis corrupti.',
- 'subject': 'Neque odio voluptates aut quam'
- },
-
- {
- 'id': '84',
- 'first-name': 'Brianne',
- 'last-name': 'West',
- 'email': 'sheila@terry.com',
- 'date': '1972-04-25 22:32:20 -0800',
- 'content':
- 'Nulla sit mollitia qui odit sit corrupti repudiandae. Voluptas consequuntur voluptatibus molestiae. Illo quidem nostrum odio et.',
- 'subject': 'Deserunt voluptas et accusamus'
- },
-
- {
- 'id': '85',
- 'first-name': 'Destiny',
- 'last-name': 'Mohr',
- 'email': 'ernestine.waters@connellypfannerstill.com',
- 'date': '2012-10-30 15:02:35 -0700',
- 'content':
- 'Eveniet voluptatem molestias dolores aut voluptates. Quisquam nemo ipsam dicta numquam aut temporibus.',
- 'subject': 'Pariatur nisi facilis tempora'
- },
-
- {
- 'id': '86',
- 'first-name': 'Brooks',
- 'last-name': 'Herman',
- 'email': 'brendan_smith@treutel.info',
- 'date': '1972-04-01 17:10:07 -0800',
- 'content': 'Qui sunt dolore molestiae minima. Suscipit ea quia a aut sunt et.',
- 'subject': 'Magni quia perferendis possimus ipsam'
- },
-
- {
- 'id': '87',
- 'first-name': 'Celestino',
- 'last-name': 'Dickens',
- 'email': 'cruz.mcdermott@ziemann.org',
- 'date': '2007-08-14 14:55:17 -0700',
- 'content': 'Saepe libero tenetur.',
- 'subject': 'Molestiae nulla aut laborum placeat perferendis aliquam'
- },
-
- {
- 'id': '88',
- 'first-name': 'Angel',
- 'last-name': 'Tillman',
- 'email': 'shayna_baumbach@durgan.biz',
- 'date': '1978-08-31 01:02:14 -0700',
- 'content':
- 'Libero sequi ea dolore. Numquam quia temporibus voluptatum rerum. Deserunt tenetur nesciunt veritatis debitis.',
- 'subject': 'Occaecati quo omnis adipisci sit perspiciatis aut modi cum'
- },
-
- {
- 'id': '89',
- 'first-name': 'Verlie',
- 'last-name': 'Tillman',
- 'email': 'aurelia@gorczany.name',
- 'date': '1995-07-27 01:25:55 -0700',
- 'content': 'Iure est veritatis qui et. Sit tempore ducimus repellat cupiditate.',
- 'subject': 'Dolorum similique expedita praesentium quisquam quasi dolorem eligendi'
- },
-
- {
- 'id': '90',
- 'first-name': 'Cornell',
- 'last-name': 'Padberg',
- 'email': 'rhianna@thiel.name',
- 'date': '2009-12-14 14:21:13 -0800',
- 'content':
- 'Ea modi consequatur. Necessitatibus sit qui voluptatem et accusantium. Cumque rerum omnis.',
- 'subject': 'Molestiae nostrum aut officiis porro tempore'
- },
-
- {
- 'id': '91',
- 'first-name': 'Carmelo',
- 'last-name': 'Kunde',
- 'email': 'beulah@rolfsonschaefer.info',
- 'date': '2010-08-14 23:10:58 -0700',
- 'content': 'Ut molestiae dolorem fuga in aliquam est provident.',
- 'subject': 'Atque occaecati temporibus et autem est'
- },
-
- {
- 'id': '92',
- 'first-name': 'Jess',
- 'last-name': 'Corwin',
- 'email': 'korey.barrows@reillyankunding.com',
- 'date': '1976-11-13 05:09:16 -0800',
- 'content':
- 'Commodi eveniet aspernatur earum nisi aut sit dolor. Odio vero facilis reprehenderit dolore. Provident voluptatibus atque qui assumenda quaerat.',
- 'subject': 'Commodi laboriosam accusamus quis dolores tempora eos'
- },
-
- {
- 'id': '93',
- 'first-name': 'Hugh',
- 'last-name': 'Hirthe',
- 'email': 'verla.dickens@keeling.name',
- 'date': '1971-03-17 23:51:15 -0800',
- 'content':
- 'Voluptatibus saepe dolor voluptas sed cupiditate incidunt. Magni velit ut beatae minus. Consequatur recusandae voluptas ad ex dolores modi quos.',
- 'subject': 'Ut pariatur odit mollitia soluta eaque magnam'
- },
-
- {
- 'id': '94',
- 'first-name': 'Elsa',
- 'last-name': 'Morissette',
- 'email': 'otto@ohara.org',
- 'date': '2006-11-27 01:10:16 -0800',
- 'content':
- 'Et architecto ipsam asperiores vitae quo. Fugiat error quidem facilis. Eaque officiis est veniam.',
- 'subject': 'Autem rerum consequatur suscipit veritatis'
- },
-
- {
- 'id': '95',
- 'first-name': 'Gianni',
- 'last-name': 'Nitzsche',
- 'email': 'maxine.carter@schimmelfritsch.com',
- 'date': '2006-02-22 21:52:15 -0800',
- 'content':
- 'Nam aut at esse. Adipisci tenetur in voluptas. Dolore quia nobis voluptatibus iure sit eaque fugit.',
- 'subject': 'Et est rerum non aut eum'
- },
-
- {
- 'id': '96',
- 'first-name': 'Reed',
- 'last-name': 'Kirlin',
- 'email': 'keaton@gutmann.net',
- 'date': '2001-08-15 19:41:38 -0700',
- 'content': 'Mollitia hic numquam dicta.',
- 'subject': 'Est accusantium et nam dolores aliquam'
- },
-
- {
- 'id': '97',
- 'first-name': 'Thelma',
- 'last-name': 'Labadie',
- 'email': 'leonor@bahringer.biz',
- 'date': '1993-01-04 20:38:12 -0800',
- 'content':
- 'Porro rerum ea similique. Vel qui est. Temporibus a distinctio dolor doloremque eos beatae.',
- 'subject': 'Aut et quasi aut'
- },
-
- {
- 'id': '98',
- 'first-name': 'Neva',
- 'last-name': 'Stehr',
- 'email': 'clifton.turner@beeroconnell.name',
- 'date': '1983-03-21 03:23:41 -0800',
- 'content': 'Voluptatem impedit sed minus. Incidunt ad est consequatur rerum mollitia.',
- 'subject': 'Eum sapiente quis placeat'
- },
-
- {
- 'id': '99',
- 'first-name': 'Jovan',
- 'last-name': 'Kunze',
- 'email': 'grady_keler@casper.net',
- 'date': '1985-11-17 01:24:57 -0800',
- 'content':
- 'Molestiae laboriosam quia adipisci delectus praesentium nam. Dolorum repudiandae delectus esse quis voluptatem similique. Illum tempore vitae quia minus.',
- 'subject': 'Nihil qui repellendus animi nostrum voluptas quisquam aut minima'
- },
-
- {
- 'id': '100',
- 'first-name': 'Agustin',
- 'last-name': 'Rowe',
- 'email': 'roderick@cartermckenzie.name',
- 'date': '2013-08-15 06:42:43 -0700',
- 'content': 'Quo eaque non laboriosam sunt. Ad aliquid laudantium quia. Aut nisi magnam.',
- 'subject': 'Aut hic iste maiores sit'
- },
-
- {
- 'id': '101',
- 'first-name': 'Lennie',
- 'last-name': 'Pacocha',
- 'email': 'valentine@goldnerryan.com',
- 'date': '1995-11-23 15:07:48 -0800',
- 'content':
- 'Provident sit voluptate odio qui. Est consequatur nobis. Quibusdam exercitationem ducimus aspernatur.',
- 'subject': 'Perferendis adipisci necessitatibus qui similique'
- },
-
- {
- 'id': '102',
- 'first-name': 'Brionna',
- 'last-name': 'Brown',
- 'email': 'jesus@gusikowski.info',
- 'date': '2007-12-21 20:22:44 -0800',
- 'content':
- 'Qui deleniti quaerat ratione doloremque ea quod consequatur. Illo consequatur nisi eos molestiae quos ullam. Enim neque rerum perspiciatis inventore consectetur.',
- 'subject': 'Perferendis ratione voluptatem quae non magnam'
- },
-
- {
- 'id': '103',
- 'first-name': 'Ceasar',
- 'last-name': 'Becker',
- 'email': 'barney@conn.biz',
- 'date': '1991-03-31 18:06:07 -0800',
- 'content': 'Cupiditate ipsa minus. Recusandae consequatur aperiam ab ut sint expedita.',
- 'subject': 'Dolore voluptatum maiores repudiandae ipsam qui consectetur veniam et'
- },
-
- {
- 'id': '104',
- 'first-name': 'Jadon',
- 'last-name': 'Walker',
- 'email': 'alexie@brownspencer.biz',
- 'date': '2014-05-05 03:04:04 -0700',
- 'content':
- 'Ipsam ut molestias necessitatibus consequatur eligendi adipisci nihil. Nemo voluptatem dolores iure enim fuga.',
- 'subject': 'Sunt officia voluptas porro et voluptatum exercitationem aut id'
- },
-
- {
- 'id': '105',
- 'first-name': 'Harvey',
- 'last-name': 'Little',
- 'email': 'dell_reichel@mayert.name',
- 'date': '1997-05-17 16:09:39 -0700',
- 'content':
- 'Saepe et voluptate enim facere. Nihil est et sint odit aut quae. Deserunt molestiae explicabo impedit iure quod ratione.',
- 'subject': 'Veniam ipsum est eum dolorem neque aut'
- },
-
- {
- 'id': '106',
- 'first-name': 'Kailey',
- 'last-name': 'Doyle',
- 'email': 'golda@hayesdavis.name',
- 'date': '1992-07-01 10:53:52 -0700',
- 'content':
- 'Necessitatibus aspernatur nesciunt rerum nam. Qui quaerat modi. Et voluptatem ut quod perspiciatis quo eligendi.',
- 'subject': 'Exercitationem voluptatem sunt hic debitis'
- },
-
- {
- 'id': '107',
- 'first-name': 'Emily',
- 'last-name': 'Gutmann',
- 'email': 'mazie@bashirian.biz',
- 'date': '1999-12-26 09:22:07 -0800',
- 'content':
- 'Rem debitis qui quia. Nihil quis quia omnis et ea aliquid. Quam praesentium commodi itaque.',
- 'subject': 'Maiores ea alias fuga'
- },
-
- {
- 'id': '108',
- 'first-name': 'Jack',
- 'last-name': 'O\'Keefe',
- 'email': 'carlos@wilkinson.biz',
- 'date': '1988-04-28 18:31:09 -0700',
- 'content': 'Ab aspernatur vel et. Architecto occaecati qui. Adipisci ut sequi culpa.',
- 'subject': 'Qui fuga rerum quo'
- },
-
- {
- 'id': '109',
- 'first-name': 'Mylene',
- 'last-name': 'Barton',
- 'email': 'sherman.kunde@block.info',
- 'date': '1996-04-16 20:06:02 -0700',
- 'content': 'Nostrum iste laboriosam corporis omnis.',
- 'subject': 'Nihil et minima odit iste et beatae'
- },
-
- {
- 'id': '110',
- 'first-name': 'Cristopher',
- 'last-name': 'Krajcik',
- 'email': 'levi@oconnell.com',
- 'date': '1989-11-08 03:06:37 -0800',
- 'content': 'Assumenda qui et accusamus magnam deserunt ut nobis.',
- 'subject': 'Aut numquam saepe placeat facilis at'
- },
-
- {
- 'id': '111',
- 'first-name': 'Amya',
- 'last-name': 'Anderson',
- 'email': 'travis@waelchigottlieb.biz',
- 'date': '1986-12-25 15:27:02 -0800',
- 'content': 'Iure numquam ea omnis nemo illo.',
- 'subject': 'Labore sit aut ea in nemo et deleniti'
- },
-
- {
- 'id': '112',
- 'first-name': 'Alphonso',
- 'last-name': 'Buckridge',
- 'email': 'duncan@barton.name',
- 'date': '1991-02-27 01:09:28 -0800',
- 'content': 'Sint ducimus sed temporibus quo. Voluptas possimus eaque earum aut.',
- 'subject': 'Quidem aliquid blanditiis quasi'
- },
-
- {
- 'id': '113',
- 'first-name': 'Jovani',
- 'last-name': 'Thompson',
- 'email': 'lewis.greenfelder@stark.biz',
- 'date': '1970-10-29 18:08:36 -0800',
- 'content': 'Modi aut ut amet ut qui.',
- 'subject': 'Deserunt est autem sed dicta qui'
- },
-
- {
- 'id': '114',
- 'first-name': 'Roosevelt',
- 'last-name': 'Blick',
- 'email': 'sophie_kaulke@kunze.biz',
- 'date': '2001-11-11 17:45:44 -0800',
- 'content': 'Debitis non exercitationem vero nostrum dignissimos. Et voluptates ad nulla.',
- 'subject': 'Quasi est ipsam accusantium sint'
- },
-
- {
- 'id': '115',
- 'first-name': 'Darren',
- 'last-name': 'Brown',
- 'email': 'jammie@hickle.net',
- 'date': '2007-10-05 11:14:49 -0700',
- 'content':
- 'Quas ut odio blanditiis corrupti quia dolor. Id enim in veniam voluptatem. Laborum delectus quidem voluptatem beatae facilis ut.',
- 'subject': 'Fugiat totam dolores harum soluta iusto et'
- },
-
- {
- 'id': '116',
- 'first-name': 'Dexter',
- 'last-name': 'Schroeder',
- 'email': 'efrain.corwin@hane.name',
- 'date': '1973-09-30 19:52:23 -0700',
- 'content': 'Debitis assumenda fugit. Sunt omnis in quod aut quibusdam qui.',
- 'subject': 'Aut iure molestias suscipit laboriosam dolores'
- },
-
- {
- 'id': '117',
- 'first-name': 'Mellie',
- 'last-name': 'Hilpert',
- 'email': 'amiya_haley@douglasbins.org',
- 'date': '1992-05-14 20:52:23 -0700',
- 'content':
- 'Vero aut perferendis commodi. Quod dolorem distinctio sint. Error nostrum reprehenderit aut quaerat officiis eaque.',
- 'subject': 'Omnis aliquid rerum fuga vero molestiae quidem eveniet'
- },
-
- {
- 'id': '118',
- 'first-name': 'Laura',
- 'last-name': 'Koepp',
- 'email': 'gus@hagenes.biz',
- 'date': '2007-08-04 22:19:10 -0700',
- 'content':
- 'Quibusdam fugiat quasi consequatur. Ipsam corporis nesciunt quae ipsa aliquid hic eius.',
- 'subject': 'Asperiores quisquam voluptatem aut quam dolores'
- },
-
- {
- 'id': '119',
- 'first-name': 'Amara',
- 'last-name': 'Jerde',
- 'email': 'estelle@marksdonnelly.info',
- 'date': '1989-08-19 01:24:43 -0700',
- 'content':
- 'Architecto voluptatum quas pariatur expedita exercitationem quo. Sint eum perferendis a. Et similique est amet dolores.',
- 'subject': 'Id consequuntur nesciunt tenetur impedit sit voluptas'
- },
-
- {
- 'id': '120',
- 'first-name': 'Jacquelyn',
- 'last-name': 'Barton',
- 'email': 'antwon_mayer@kshleringibson.info',
- 'date': '1989-08-19 13:07:02 -0700',
- 'content': 'Quos enim repellendus praesentium sit rerum deserunt.',
- 'subject': 'Et omnis hic autem ipsa tempora impedit perspiciatis'
- },
-
- {
- 'id': '121',
- 'first-name': 'Micaela',
- 'last-name': 'Runte',
- 'email': 'vivianne.graham@vonrueden.org',
- 'date': '1986-09-27 01:16:29 -0700',
- 'content': 'Et neque rem.',
- 'subject': 'Enim facere corrupti accusamus quam consequatur beatae aspernatur vero'
- },
-
- {
- 'id': '122',
- 'first-name': 'Millie',
- 'last-name': 'Flatley',
- 'email': 'gino@kihn.biz',
- 'date': '1980-02-09 01:35:05 -0800',
- 'content': 'Rerum sint quis esse minus. Aut at asperiores. Amet magni beatae atque.',
- 'subject': 'Illo vitae blanditiis et impedit in dolor'
- },
-
- {
- 'id': '123',
- 'first-name': 'Sincere',
- 'last-name': 'Rohan',
- 'email': 'zora@beattyerdman.org',
- 'date': '2002-11-11 22:02:22 -0800',
- 'content': 'Ut error voluptatem aut ratione molestiae. Omnis qui rem delectus.',
- 'subject': 'Unde sed voluptas assumenda non animi quo'
- },
-
- {
- 'id': '124',
- 'first-name': 'Vicky',
- 'last-name': 'Kautzer',
- 'email': 'mustafa.lueilwitz@tremblay.name',
- 'date': '2014-08-15 11:18:05 -0700',
- 'content':
- 'Nostrum quis et et molestiae molestiae. Corporis corrupti deleniti qui fugiat eos. Porro qui quis mollitia.',
- 'subject': 'Quisquam ex esse dolore'
- },
-
- {
- 'id': '125',
- 'first-name': 'Lavon',
- 'last-name': 'Padberg',
- 'email': 'destin_sanford@reynolds.net',
- 'date': '2005-07-11 21:24:34 -0700',
- 'content': 'Officia dolorem autem beatae soluta numquam aperiam et.',
- 'subject': 'Ad labore aut corporis'
- },
-
- {
- 'id': '126',
- 'first-name': 'Shaina',
- 'last-name': 'Dare',
- 'email': 'carrie_sawayn@buckridge.net',
- 'date': '2001-10-12 08:02:09 -0700',
- 'content': 'Ex doloremque dolor deleniti.',
- 'subject': 'Asperiores recusandae reprehenderit quia tempore qui ipsam sit'
- },
-
- {
- 'id': '127',
- 'first-name': 'Sigrid',
- 'last-name': 'Farrell',
- 'email': 'soledad_abshire@miller.net',
- 'date': '2003-03-24 17:55:50 -0800',
- 'content': 'Debitis ea soluta eos ut omnis. Ut et laboriosam. Quaerat sit velit impedit.',
- 'subject': 'Eum et nesciunt quidem quo repudiandae rerum doloremque beatae'
- },
-
- {
- 'id': '128',
- 'first-name': 'Viola',
- 'last-name': 'Dooley',
- 'email': 'myrtice_grant@zemlakbashirian.com',
- 'date': '2006-06-01 21:17:02 -0700',
- 'content': 'Sit doloremque est aut voluptatem.',
- 'subject': 'Aut accusamus consectetur nihil iusto'
- },
-
- {
- 'id': '129',
- 'first-name': 'Davion',
- 'last-name': 'Conn',
- 'email': 'travis@bins.biz',
- 'date': '1993-11-26 09:03:37 -0800',
- 'content':
- 'Voluptatibus ipsum mollitia fugit aspernatur enim sint. Laudantium exercitationem sed voluptas consequatur quis.',
- 'subject': 'Illum aspernatur tempora amet itaque ipsam distinctio aliquid'
- },
-
- {
- 'id': '130',
- 'first-name': 'Hobart',
- 'last-name': 'Oberbrunner',
- 'email': 'eric@wisozk.net',
- 'date': '2000-02-11 07:40:02 -0800',
- 'content': 'Quis aut sint officia sunt.',
- 'subject': 'Ut pariatur explicabo consequatur libero distinctio nulla consequatur placeat'
- },
-
- {
- 'id': '131',
- 'first-name': 'Raleigh',
- 'last-name': 'Hegmann',
- 'email': 'jasen.koepp@hickle.name',
- 'date': '1993-03-01 22:48:23 -0800',
- 'content':
- 'Delectus aut quod maxime incidunt et consequatur. Nihil eos et eveniet quo iure. Alias facilis earum dicta nulla quo sed.',
- 'subject': 'Aliquam eos aliquid dolor'
- },
-
- {
- 'id': '132',
- 'first-name': 'Hector',
- 'last-name': 'Denesik',
- 'email': 'bernice@leuschke.biz',
- 'date': '2013-08-03 14:45:55 -0700',
- 'content': 'Et ut dicta. Qui sunt vel et voluptas hic suscipit.',
- 'subject': 'Ipsum quo est consequatur'
- },
-
- {
- 'id': '133',
- 'first-name': 'Nikko',
- 'last-name': 'Rolfson',
- 'email': 'crystel@upton.net',
- 'date': '1977-02-19 16:22:15 -0800',
- 'content': 'Velit quo repellendus consequatur.',
- 'subject': 'Exercitationem omnis aut id deserunt nihil et inventore'
- },
-
- {
- 'id': '134',
- 'first-name': 'Jovany',
- 'last-name': 'Nienow',
- 'email': 'neil.muller@lakin.info',
- 'date': '2004-09-28 21:55:43 -0700',
- 'content':
- 'Voluptatibus numquam blanditiis quibusdam. Illum suscipit dolorum. Sunt amet est sint.',
- 'subject': 'Esse nihil est voluptas rerum ea'
- },
-
- {
- 'id': '135',
- 'first-name': 'Ellis',
- 'last-name': 'Kohler',
- 'email': 'cordie_bartoletti@barrows.net',
- 'date': '1989-09-19 13:57:30 -0700',
- 'content':
- 'Eum corporis nobis laborum fugiat amet alias. Voluptatum quasi ducimus fuga corrupti. Mollitia modi laborum.',
- 'subject': 'Ipsum modi nulla et'
- },
-
- {
- 'id': '136',
- 'first-name': 'Marley',
- 'last-name': 'Runolfsson',
- 'email': 'kian_vonrueden@collier.info',
- 'date': '2003-01-17 06:33:04 -0800',
- 'content': 'Et rerum explicabo iusto ipsa ipsum. Quia ipsa ab sed perspiciatis.',
- 'subject': 'Voluptas esse iure quia hic dolor eligendi velit maiores'
- },
-
- {
- 'id': '137',
- 'first-name': 'Grant',
- 'last-name': 'Jenkins',
- 'email': 'hayden.altenwerth@corkeryankunding.net',
- 'date': '1970-03-24 13:04:46 -0800',
- 'content': 'Tenetur odit ratione voluptatum dolore qui.',
- 'subject': 'Tempore est molestiae id'
- },
-
- {
- 'id': '138',
- 'first-name': 'Deangelo',
- 'last-name': 'Koss',
- 'email': 'reba.skiles@bruen.com',
- 'date': '1999-10-16 20:28:42 -0700',
- 'content': 'Sit vero sint ut beatae iure. Minima harum tempora sit rerum aut.',
- 'subject': 'Aspernatur cumque non consequatur blanditiis enim quas quam'
- },
-
- {
- 'id': '139',
- 'first-name': 'Mariana',
- 'last-name': 'Jakubowski',
- 'email': 'brett@swift.biz',
- 'date': '1970-07-04 08:54:29 -0700',
- 'content': 'Beatae expedita praesentium ea corrupti. Aut sint ad et sunt.',
- 'subject': 'Dolore distinctio consequatur aut laudantium officiis aliquid soluta'
- },
-
- {
- 'id': '140',
- 'first-name': 'Leonard',
- 'last-name': 'Kovacek',
- 'email': 'jermain@dachbruen.biz',
- 'date': '1981-10-15 00:39:10 -0700',
- 'content':
- 'Deserunt cupiditate modi. Eius consequatur aut dolor nostrum porro dignissimos. Labore consequatur quod est et distinctio possimus ducimus.',
- 'subject': 'Et rerum id voluptates et iure eligendi rerum'
- },
-
- {
- 'id': '141',
- 'first-name': 'Etha',
- 'last-name': 'Ondricka',
- 'email': 'noemy@okuneva.org',
- 'date': '1994-04-29 12:19:51 -0700',
- 'content':
- 'Velit fuga quasi pariatur consectetur est nihil. Dolore nisi dolores quia qui voluptatem inventore provident.',
- 'subject': 'Enim est commodi nisi autem asperiores molestiae minima'
- },
-
- {
- 'id': '142',
- 'first-name': 'Nannie',
- 'last-name': 'Fadel',
- 'email': 'frida.streich@prosacco.org',
- 'date': '2012-12-15 16:56:24 -0800',
- 'content': 'Rerum id quo. Recusandae aut optio voluptate perspiciatis tempore sed nemo.',
- 'subject': 'Pariatur soluta praesentium enim quo quam alias consequuntur in'
- },
-
- {
- 'id': '143',
- 'first-name': 'Shyanne',
- 'last-name': 'Kunze',
- 'email': 'annabel@littel.net',
- 'date': '1992-12-09 23:41:23 -0800',
- 'content': 'Dolores iure iste unde. Illo esse autem harum perspiciatis.',
- 'subject': 'Atque illum et qui'
- },
-
- {
- 'id': '144',
- 'first-name': 'Eloy',
- 'last-name': 'Barton',
- 'email': 'leonie_gulgowski@skiles.com',
- 'date': '2013-01-12 20:05:57 -0800',
- 'content': 'Cumque id sapiente explicabo. Voluptas pariatur quibusdam dolores et.',
- 'subject': 'Ut dolore velit qui omnis'
- },
-
- {
- 'id': '145',
- 'first-name': 'Rosalinda',
- 'last-name': 'Pfeffer',
- 'email': 'anabelle@langworth.com',
- 'date': '2001-05-17 05:43:52 -0700',
- 'content': 'Et voluptatem quasi voluptatum.',
- 'subject': 'Voluptatum quia incidunt ut repudiandae blanditiis'
- },
-
- {
- 'id': '146',
- 'first-name': 'William',
- 'last-name': 'Bogisich',
- 'email': 'bertha@gibsonrohan.info',
- 'date': '2009-11-01 04:28:13 -0800',
- 'content':
- 'Quaerat dolorem odio et dolor saepe quia odit. Corporis molestiae ab ipsa occaecati autem fuga dicta. Voluptate ratione sunt.',
- 'subject': 'Ipsam quidem mollitia blanditiis magnam ut et'
- },
-
- {
- 'id': '147',
- 'first-name': 'Laurianne',
- 'last-name': 'Bergstrom',
- 'email': 'brisa_howe@dare.net',
- 'date': '2003-03-23 21:58:11 -0800',
- 'content': 'Et porro recusandae aut. Tenetur voluptas aperiam ut vitae.',
- 'subject': 'Molestias autem qui nisi mollitia nulla dolorum repudiandae hic'
- },
-
- {
- 'id': '148',
- 'first-name': 'Carroll',
- 'last-name': 'Hickle',
- 'email': 'noemi.grady@grimesritchie.com',
- 'date': '1996-07-15 02:55:52 -0700',
- 'content': 'Quia voluptas assumenda. Numquam inventore facilis dicta qui ipsa reiciendis.',
- 'subject': 'Perferendis rerum vel incidunt molestias recusandae'
- },
-
- {
- 'id': '149',
- 'first-name': 'Jasen',
- 'last-name': 'Romaguera',
- 'email': 'jayce@berge.name',
- 'date': '1984-04-12 11:56:39 -0800',
- 'content': 'Consectetur molestias perspiciatis ut omnis aliquid.',
- 'subject': 'Hic optio accusamus qui adipisci repellendus ipsa in'
- },
-
- {
- 'id': '150',
- 'first-name': 'Heaven',
- 'last-name': 'Fay',
- 'email': 'enola@sanfordsteuber.net',
- 'date': '2000-11-23 00:18:07 -0800',
- 'content':
- 'Quia itaque temporibus. Provident ducimus quidem consectetur qui voluptatum. Sunt cum quis dolorum hic.',
- 'subject': 'Ad excepturi illum doloremque ducimus corporis ut qui omnis'
- },
-
- {
- 'id': '151',
- 'first-name': 'Wilburn',
- 'last-name': 'Cartwright',
- 'email': 'jaida_erdman@nitzsche.com',
- 'date': '2011-09-19 01:58:53 -0700',
- 'content': 'Autem iure magni ut odio amet et.',
- 'subject': 'Fuga quis quidem sint laborum et delectus iste'
- },
-
- {
- 'id': '152',
- 'first-name': 'Concepcion',
- 'last-name': 'McLaughlin',
- 'email': 'bernardo_langworth@jakubowski.org',
- 'date': '1992-08-20 13:35:09 -0700',
- 'content': 'Rerum laboriosam omnis nobis eaque odit sequi dicta.',
- 'subject': 'Sint accusantium ab quis sed ipsa'
- },
-
- {
- 'id': '153',
- 'first-name': 'Vita',
- 'last-name': 'Fisher',
- 'email': 'chanelle_gulgowski@roob.info',
- 'date': '2005-09-21 12:09:45 -0700',
- 'content':
- 'Sunt quibusdam adipisci accusantium laborum distinctio voluptate autem. Quis pariatur culpa ut et. Fuga similique dignissimos culpa dolorum neque reiciendis.',
- 'subject': 'Nulla enim et fugiat eveniet ducimus delectus'
- },
-
- {
- 'id': '154',
- 'first-name': 'Elliott',
- 'last-name': 'Champlin',
- 'email': 'kamille@kulascain.biz',
- 'date': '2003-05-20 15:42:54 -0700',
- 'content':
- 'Eos quisquam et voluptates rerum vel. Consectetur veniam voluptatem minus totam numquam in.',
- 'subject': 'Deleniti ipsum et odio'
- },
-
- {
- 'id': '155',
- 'first-name': 'Heidi',
- 'last-name': 'Macejkovic',
- 'email': 'stefanie@barrowshagenes.info',
- 'date': '1983-06-02 17:59:14 -0700',
- 'content': 'Ut officiis animi exercitationem delectus suscipit qui voluptatibus.',
- 'subject': 'Eveniet ipsam asperiores qui aut consectetur vel provident'
- },
-
- {
- 'id': '156',
- 'first-name': 'Janae',
- 'last-name': 'Pollich',
- 'email': 'brianne.sauer@marquardtsteuber.com',
- 'date': '2000-05-14 07:13:30 -0700',
- 'content': 'Facilis sit ut odit.',
- 'subject': 'Sapiente explicabo sequi molestias illo saepe'
- },
-
- {
- 'id': '157',
- 'first-name': 'Kaylin',
- 'last-name': 'Lindgren',
- 'email': 'urban.franecki@wilkinsonwilderman.org',
- 'date': '2014-09-09 00:48:38 -0700',
- 'content': 'Eaque ad repellendus est nihil iste vero.',
- 'subject': 'Deserunt qui dolor rerum ut beatae aut'
- },
-
- {
- 'id': '158',
- 'first-name': 'Garland',
- 'last-name': 'Nienow',
- 'email': 'ellen.schultz@kihn.org',
- 'date': '2013-10-27 00:18:14 -0700',
- 'content': 'Quam voluptatem nam est.',
- 'subject': 'Et occaecati quisquam impedit dolore quod'
- },
-
- {
- 'id': '159',
- 'first-name': 'Lilly',
- 'last-name': 'Hills',
- 'email': 'macey@labadie.biz',
- 'date': '1981-02-23 03:46:55 -0800',
- 'content':
- 'Quia perferendis est consequuntur voluptates cumque commodi. Laboriosam expedita sit excepturi.',
- 'subject': 'Eos doloribus repellendus provident'
- },
-
- {
- 'id': '160',
- 'first-name': 'Lilla',
- 'last-name': 'Abshire',
- 'email': 'roselyn@rippin.org',
- 'date': '1998-05-16 00:55:49 -0700',
- 'content': 'Ratione deserunt ut ut beatae praesentium qui. Nulla ut ipsam tempore.',
- 'subject': 'Autem nostrum tempora iure laborum'
- },
-
- {
- 'id': '161',
- 'first-name': 'Alessandro',
- 'last-name': 'Hayes',
- 'email': 'gia_bradtke@schimmelwalsh.biz',
- 'date': '2001-11-28 23:52:57 -0800',
- 'content':
- 'Quasi perspiciatis tenetur dolorum. Quae cupiditate fuga molestiae et tempore soluta.',
- 'subject': 'Non ipsam quis soluta'
- },
-
- {
- 'id': '162',
- 'first-name': 'Sharon',
- 'last-name': 'Goodwin',
- 'email': 'ulices.schimmel@oreillyabshire.name',
- 'date': '2010-03-12 00:46:00 -0800',
- 'content': 'Neque omnis in. Qui ad sint. Velit voluptatibus repellat esse at.',
- 'subject': 'Magni exercitationem quas consectetur qui quia id'
- },
-
- {
- 'id': '163',
- 'first-name': 'Claude',
- 'last-name': 'Gleason',
- 'email': 'ken.gulgowski@labadie.net',
- 'date': '2003-05-30 14:58:54 -0700',
- 'content': 'Et sit non harum quo sunt. Odio beatae voluptatem ad. Nemo in hic nulla.',
- 'subject': 'Nobis consequatur non sunt sequi ex nihil'
- },
-
- {
- 'id': '164',
- 'first-name': 'Maximilian',
- 'last-name': 'Mann',
- 'email': 'samir@stehr.biz',
- 'date': '1993-08-21 15:54:18 -0700',
- 'content':
- 'Minus quae voluptatem sequi. Distinctio voluptatem amet iusto velit et praesentium. Distinctio ipsum voluptas voluptas.',
- 'subject': 'Facere voluptatem laudantium laboriosam omnis'
- },
-
- {
- 'id': '165',
- 'first-name': 'Jennyfer',
- 'last-name': 'Satterfield',
- 'email': 'janiya_senger@olson.info',
- 'date': '2006-09-21 00:36:50 -0700',
- 'content': 'Doloribus praesentium excepturi omnis.',
- 'subject': 'Non fuga unde incidunt ad exercitationem maxime laboriosam qui'
- },
-
- {
- 'id': '166',
- 'first-name': 'Robin',
- 'last-name': 'Murray',
- 'email': 'alycia@cruickshank.name',
- 'date': '1985-10-04 03:44:39 -0700',
- 'content': 'Repudiandae dolorem ut. Possimus earum dignissimos temporibus amet vel eum.',
- 'subject': 'Vel culpa debitis quam'
- },
-
- {
- 'id': '167',
- 'first-name': 'Albina',
- 'last-name': 'Reinger',
- 'email': 'guie.gleason@gorczany.info',
- 'date': '1985-10-02 08:07:53 -0700',
- 'content': 'Natus rerum repellat voluptas. Distinctio dolor est in dolores.',
- 'subject': 'Modi perspiciatis iure odio hic et dignissimos rem qui'
- },
-
- {
- 'id': '168',
- 'first-name': 'Eloisa',
- 'last-name': 'Wolf',
- 'email': 'leopold@jenkins.info',
- 'date': '2007-02-19 09:25:29 -0800',
- 'content': 'Corporis ut dolorem ullam quidem ratione. Nam eveniet dicta autem eum.',
- 'subject': 'Facilis voluptas vel repellat et aut amet est'
- },
-
- {
- 'id': '169',
- 'first-name': 'Caden',
- 'last-name': 'Cartwright',
- 'email': 'mohammad_lockman@okoncrooks.net',
- 'date': '1974-11-14 03:12:44 -0800',
- 'content':
- 'Sunt nobis voluptate quasi sapiente magni a officia. Laudantium perspiciatis quod quis quidem voluptatum pariatur. Sit ut optio tempora.',
- 'subject': 'Nihil maxime officia et repellat'
- },
-
- {
- 'id': '170',
- 'first-name': 'Raul',
- 'last-name': 'Sipes',
- 'email': 'danial.miller@kulas.info',
- 'date': '1996-12-11 14:14:16 -0800',
- 'content':
- 'Ea rerum quo id omnis. Hic est voluptate voluptatem ut. Rerum eos ipsa laboriosam et ut expedita.',
- 'subject': 'Aliquam reiciendis quam expedita sed ad neque voluptas'
- },
-
- {
- 'id': '171',
- 'first-name': 'Allie',
- 'last-name': 'Runolfsson',
- 'email': 'skye@marvin.com',
- 'date': '2011-07-31 19:37:22 -0700',
- 'content': 'Perspiciatis mollitia fugit sunt et.',
- 'subject': 'Nihil expedita neque reprehenderit'
- },
-
- {
- 'id': '172',
- 'first-name': 'Belle',
- 'last-name': 'Nader',
- 'email': 'eugenia@mante.info',
- 'date': '1995-09-06 05:30:08 -0700',
- 'content': 'Expedita delectus quis ipsa dolore voluptatum.',
- 'subject': 'Recusandae quasi ullam consequatur assumenda aliquid unde'
- },
-
- {
- 'id': '173',
- 'first-name': 'Clemens',
- 'last-name': 'Tromp',
- 'email': 'geovanny@kilback.org',
- 'date': '1980-11-28 08:48:35 -0800',
- 'content': 'Sint eos ea quidem tempora.',
- 'subject': 'Velit aperiam consequatur ut et aliquam at'
- },
-
- {
- 'id': '174',
- 'first-name': 'Bettie',
- 'last-name': 'Mueller',
- 'email': 'edgardo@little.net',
- 'date': '1983-06-26 14:10:56 -0700',
- 'content': 'Dolore tempore accusamus.',
- 'subject': 'Autem tempore et ut'
- },
-
- {
- 'id': '175',
- 'first-name': 'Guy',
- 'last-name': 'King',
- 'email': 'macie@schmeler.info',
- 'date': '1999-03-28 22:34:59 -0800',
- 'content': 'Recusandae laborum ut et eaque eum.',
- 'subject': 'Dolor ullam totam consequatur eos fuga'
- },
-
- {
- 'id': '176',
- 'first-name': 'Cydney',
- 'last-name': 'Cronin',
- 'email': 'camren@thompson.org',
- 'date': '1993-10-23 02:50:41 -0700',
- 'content': 'Exercitationem modi eos sint vero. Iste possimus quis. Non est voluptas.',
- 'subject': 'Tempora ipsum soluta ut corrupti omnis in'
- },
-
- {
- 'id': '177',
- 'first-name': 'Ludwig',
- 'last-name': 'Hoeger',
- 'email': 'javon@torpolson.info',
- 'date': '2007-12-20 19:09:13 -0800',
- 'content': 'Architecto ut optio tempore pariatur itaque saepe.',
- 'subject': 'Earum unde quis officiis doloremque et animi qui'
- },
-
- {
- 'id': '178',
- 'first-name': 'Travon',
- 'last-name': 'Jacobi',
- 'email': 'jameson_streich@hansen.org',
- 'date': '2013-02-03 09:53:51 -0800',
- 'content': 'Autem dolorem totam atque id sit. Consectetur dolor maiores.',
- 'subject': 'Quia autem deleniti ullam neque odio'
- },
-
- {
- 'id': '179',
- 'first-name': 'Brennan',
- 'last-name': 'Jaskolski',
- 'email': 'harold_thompson@schaefer.info',
- 'date': '2004-01-13 10:53:47 -0800',
- 'content': 'Libero et dolorem nihil. Omnis consequuntur possimus ut.',
- 'subject': 'Eum labore omnis ipsa doloremque consequuntur soluta esse fuga'
- },
-
- {
- 'id': '180',
- 'first-name': 'Clifton',
- 'last-name': 'Boyer',
- 'email': 'justine@skiles.biz',
- 'date': '2000-01-28 22:33:14 -0800',
- 'content':
- 'Nobis recusandae fugiat quibusdam doloribus. Aut praesentium corrupti tenetur ullam quia.',
- 'subject': 'Ea dolorem voluptas aut cumque inventore delectus non molestiae'
- },
-
- {
- 'id': '181',
- 'first-name': 'Walker',
- 'last-name': 'Rogahn',
- 'email': 'stanton@rempel.net',
- 'date': '2012-04-02 20:05:38 -0700',
- 'content': 'Consectetur et soluta. Minus voluptatem quod aut vitae praesentium.',
- 'subject': 'Tenetur architecto reprehenderit corporis fuga et rerum vel'
- },
-
- {
- 'id': '182',
- 'first-name': 'Jennings',
- 'last-name': 'Hills',
- 'email': 'kenton@murrayharvey.biz',
- 'date': '2007-09-24 22:09:51 -0700',
- 'content':
- 'Velit porro quidem nostrum. Perspiciatis consequatur consectetur reiciendis sunt cupiditate quae. Vitae et ut autem iure.',
- 'subject': 'Cupiditate quis maiores omnis'
- },
-
- {
- 'id': '183',
- 'first-name': 'Julianne',
- 'last-name': 'O\'Kon',
- 'email': 'helene@abshire.com',
- 'date': '1987-02-09 22:56:12 -0800',
- 'content':
- 'Voluptas voluptatem veniam porro dolorem maxime. Itaque eveniet laborum optio sed aspernatur omnis. Veritatis enim itaque sint illo ipsam eius.',
- 'subject': 'Corporis et laboriosam aspernatur aut'
- },
-
- {
- 'id': '184',
- 'first-name': 'Raymond',
- 'last-name': 'Orn',
- 'email': 'cloyd@rempel.biz',
- 'date': '2014-02-04 04:33:02 -0800',
- 'content':
- 'Eum voluptatibus accusantium rem. Deleniti harum eum. Illo est facere illum saepe voluptas.',
- 'subject': 'Eveniet est architecto id ut rerum nam quidem'
- },
-
- {
- 'id': '185',
- 'first-name': 'Johan',
- 'last-name': 'Legros',
- 'email': 'rosie_ernser@wolf.com',
- 'date': '1989-03-02 11:17:10 -0800',
- 'content': 'Architecto explicabo praesentium amet eaque quibusdam.',
- 'subject': 'Consectetur fugiat iusto omnis aspernatur ut'
- },
-
- {
- 'id': '186',
- 'first-name': 'Daryl',
- 'last-name': 'Labadie',
- 'email': 'ashly_thompson@casper.net',
- 'date': '2003-01-28 00:02:56 -0800',
- 'content': 'Et est doloribus. Fuga hic sed voluptatibus ullam officia aspernatur.',
- 'subject': 'A sunt eum quas accusamus'
- },
-
- {
- 'id': '187',
- 'first-name': 'Gavin',
- 'last-name': 'Moore',
- 'email': 'dahlia@leffleroberbrunner.biz',
- 'date': '1970-10-15 07:36:57 -0700',
- 'content': 'Sapiente ipsum magni dolore est dolor.',
- 'subject': 'Est maxime consequatur esse qui dicta aut quaerat'
- },
-
- {
- 'id': '188',
- 'first-name': 'Coby',
- 'last-name': 'Swaniawski',
- 'email': 'millie.labadie@wuckert.name',
- 'date': '2012-09-14 00:25:46 -0700',
- 'content':
- 'Magni qui molestias debitis reprehenderit vel quo est. Blanditiis debitis autem neque non illo.',
- 'subject': 'Rerum accusantium magni dolorem in reprehenderit et voluptas'
- },
-
- {
- 'id': '189',
- 'first-name': 'Luis',
- 'last-name': 'Stracke',
- 'email': 'merle@mrazswaniawski.biz',
- 'date': '2007-11-11 05:28:46 -0800',
- 'content': 'Neque magnam sint porro reprehenderit quo. In et reiciendis non velit et eum quos.',
- 'subject': 'Sit voluptates nulla perspiciatis debitis dolor eaque a'
- },
-
- {
- 'id': '190',
- 'first-name': 'Leone',
- 'last-name': 'Huel',
- 'email': 'emil@botsford.biz',
- 'date': '2004-03-16 23:46:45 -0800',
- 'content': 'Vitae amet et quae ullam.',
- 'subject': 'Rerum enim voluptate qui'
- },
-
- {
- 'id': '191',
- 'first-name': 'Aylin',
- 'last-name': 'Kling',
- 'email': 'anderson_jast@kozeyparisian.com',
- 'date': '1979-06-17 04:05:50 -0700',
- 'content': 'Quam eligendi numquam sint. Non ipsa et qui error dolor velit.',
- 'subject': 'Culpa iste rerum facere praesentium deleniti sequi'
- },
-
- {
- 'id': '192',
- 'first-name': 'Junior',
- 'last-name': 'Bartoletti',
- 'email': 'te@kuvalis.net',
- 'date': '1994-12-09 11:00:34 -0800',
- 'content': 'Velit eos et nemo dolore eum necessitatibus. Ea inventore adipisci.',
- 'subject': 'Velit dolorem cumque ipsa'
- },
-
- {
- 'id': '193',
- 'first-name': 'Nathanael',
- 'last-name': 'Hermiston',
- 'email': 'macy.cole@wittingcasper.info',
- 'date': '2002-01-06 17:45:52 -0800',
- 'content':
- 'Corporis occaecati quidem quia repudiandae repellendus beatae similique. Inventore quo ullam.',
- 'subject': 'Quidem expedita quia inventore dolores ratione totam et dignissimos'
- },
-
- {
- 'id': '194',
- 'first-name': 'Hal',
- 'last-name': 'Bruen',
- 'email': 'nathen.ziemann@gerlachko.name',
- 'date': '1996-03-01 01:35:30 -0800',
- 'content':
- 'Qui eius aspernatur et aut et vel in. Adipisci aliquid consequatur dolores et ut. Est aut temporibus.',
- 'subject': 'Voluptas placeat eveniet non quas assumenda quam minus'
- },
-
- {
- 'id': '195',
- 'first-name': 'Freddie',
- 'last-name': 'Thompson',
- 'email': 'elia@aufderharbrown.org',
- 'date': '2005-03-20 05:07:30 -0800',
- 'content': 'Dolor nemo sed molestiae quae quia.',
- 'subject': 'Quam sint et voluptatem et fuga sint ut saepe'
- },
-
- {
- 'id': '196',
- 'first-name': 'Aida',
- 'last-name': 'Gorczany',
- 'email': 'olga.labadie@abshire.name',
- 'date': '1989-07-26 04:26:19 -0700',
- 'content':
- 'Sit qui voluptatem facere. Similique alias quia sit ipsum. Ut corrupti tempore molestiae.',
- 'subject': 'Qui veniam blanditiis nesciunt beatae tempore aut fugiat maiores'
- },
-
- {
- 'id': '197',
- 'first-name': 'Isabelle',
- 'last-name': 'Collier',
- 'email': 'christiana_gottlieb@borer.biz',
- 'date': '1978-05-15 13:13:34 -0700',
- 'content': 'Aliquam earum velit ut.',
- 'subject': 'Neque et voluptate ratione totam voluptas est nulla ipsum'
- },
-
- {
- 'id': '198',
- 'first-name': 'Ida',
- 'last-name': 'Reichert',
- 'email': 'mervin@keeling.com',
- 'date': '1991-02-06 05:02:15 -0800',
- 'content':
- 'Velit in at et dicta tenetur. Doloremque cupiditate est. Excepturi non minus aspernatur dolores qui quaerat architecto.',
- 'subject': 'Ut voluptas qui ad minus'
- },
-
- {
- 'id': '199',
- 'first-name': 'Angelina',
- 'last-name': 'Mueller',
- 'email': 'leonel@purdyschroeder.org',
- 'date': '2008-06-17 01:01:57 -0700',
- 'content':
- 'Recusandae eius non necessitatibus. Quisquam qui quo. Voluptas dolorem dolorem sit repellat laudantium ducimus qui.',
- 'subject': 'Dolorem atque impedit qui soluta'
- },
-
- {
- 'id': '200',
- 'first-name': 'Marcelle',
- 'last-name': 'Connelly',
- 'email': 'heath@leuschke.net',
- 'date': '1983-10-02 18:32:18 -0700',
- 'content':
- 'Debitis quasi voluptates et voluptatibus rerum. Et explicabo quia qui qui voluptate dolor.',
- 'subject': 'Rem molestiae nobis consequatur eligendi ut'
- },
- {
- 'id': '201',
- 'first-name': 'Bob',
- 'last-name': 'Brown',
- 'email': 'bob@brown.net',
- 'date': '1983-10-02 18:32:18 -0700',
- 'content':
- 'Debitis quasi voluptates et voluptatibus rerum. Et explicabo quia qui qui voluptate dolor.',
- 'subject': 'Urgent question about whipped cream',
- 'draft': true
- },
- {
- 'id': '202',
- 'first-name': 'Mary',
- 'last-name': 'Jones',
- 'email': 'mary@jones.net',
- 'date': '1983-10-02 18:32:18 -0700',
- 'content':
- 'Debitis quasi voluptates et voluptatibus rerum. Et explicabo quia qui qui voluptate dolor.',
- 'subject': 'Fwd: wedding photos',
- 'draft': true
- }
-]
diff --git a/modules/playground/src/routing_deprecated/app/drafts.html b/modules/playground/src/routing_deprecated/app/drafts.html
deleted file mode 100644
index 6cfee645bd..0000000000
--- a/modules/playground/src/routing_deprecated/app/drafts.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
diff --git a/modules/playground/src/routing_deprecated/app/inbox-app.html b/modules/playground/src/routing_deprecated/app/inbox-app.html
deleted file mode 100644
index 4629749c18..0000000000
--- a/modules/playground/src/routing_deprecated/app/inbox-app.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
- Inbox
- Drafts
-
-
diff --git a/modules/playground/src/routing_deprecated/app/inbox-app.ts b/modules/playground/src/routing_deprecated/app/inbox-app.ts
deleted file mode 100644
index 003abee516..0000000000
--- a/modules/playground/src/routing_deprecated/app/inbox-app.ts
+++ /dev/null
@@ -1,159 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {Location} from '@angular/common';
-import {Component, Injectable} from '@angular/core';
-import {DateWrapper, isPresent} from '@angular/core/src/facade/lang';
-import {Route, RouteConfig, RouteParams, Router, RouterLink, RouterOutlet} from '@angular/router-deprecated';
-
-import * as db from './data';
-
-class InboxRecord {
- id: string = '';
- subject: string = '';
- content: string = '';
- email: string = '';
- firstName: string = '';
- lastName: string = '';
- date: string;
- draft: boolean = false;
-
- constructor(data: {
- id: string,
- subject: string,
- content: string,
- email: string,
- firstName: string,
- lastName: string,
- date: string, draft?: boolean
- } = null) {
- if (isPresent(data)) {
- this.setData(data);
- }
- }
-
- setData(record: {
- id: string,
- subject: string,
- content: string,
- email: string,
- firstName: string,
- lastName: string,
- date: string, draft?: boolean
- }) {
- this.id = record['id'];
- this.subject = record['subject'];
- this.content = record['content'];
- this.email = record['email'];
- this.firstName = (record as any /** TODO #9100 */)['first-name'];
- this.lastName = (record as any /** TODO #9100 */)['last-name'];
- this.date = record['date'];
- this.draft = record['draft'] == true;
- }
-}
-
-@Injectable()
-class DbService {
- getData(): Promise { return Promise.resolve(db.data); }
-
- drafts(): Promise {
- return this.getData().then(
- (data: any[]): any[] =>
- data.filter(record => isPresent(record['draft']) && record['draft'] == true));
- }
-
- emails(): Promise {
- return this.getData().then(
- (data: any[]): any[] => data.filter(record => !isPresent(record['draft'])));
- }
-
- email(id: any /** TODO #9100 */): Promise {
- return this.getData().then((data: any[]) => {
- for (var i = 0; i < data.length; i++) {
- var entry = data[i];
- if (entry['id'] == id) {
- return entry;
- }
- }
- return null;
- });
- }
-}
-
-@Component(
- {selector: 'inbox-detail', directives: [RouterLink], templateUrl: 'app/inbox-detail.html'})
-class InboxDetailCmp {
- record: InboxRecord = new InboxRecord();
- ready: boolean = false;
-
- constructor(db: DbService, params: RouteParams) {
- var id = params.get('id');
- db.email(id).then((data) => { this.record.setData(data); });
- }
-}
-
-@Component({selector: 'inbox', templateUrl: 'app/inbox.html', directives: [RouterLink]})
-class InboxCmp {
- items: InboxRecord[] = [];
- ready: boolean = false;
-
- constructor(public router: Router, db: DbService, params: RouteParams) {
- var sortType = params.get('sort');
- var sortEmailsByDate = isPresent(sortType) && sortType == 'date';
-
- db.emails().then((emails: any[]) => {
- this.ready = true;
- this.items = emails.map(data => new InboxRecord(data));
-
- if (sortEmailsByDate) {
- this.items.sort(
- (a: InboxRecord, b: InboxRecord) =>
- DateWrapper.toMillis(DateWrapper.fromISOString(a.date)) <
- DateWrapper.toMillis(DateWrapper.fromISOString(b.date)) ?
- -1 :
- 1);
- }
- });
- }
-}
-
-
-@Component({selector: 'drafts', templateUrl: 'app/drafts.html', directives: [RouterLink]})
-class DraftsCmp {
- items: InboxRecord[] = [];
- ready: boolean = false;
-
- constructor(public router: Router, db: DbService) {
- db.drafts().then((drafts: any[]) => {
- this.ready = true;
- this.items = drafts.map(data => new InboxRecord(data));
- });
- }
-}
-
-@Component({
- selector: 'inbox-app',
- viewProviders: [DbService],
- templateUrl: 'app/inbox-app.html',
- directives: [RouterOutlet, RouterLink]
-})
-@RouteConfig([
- new Route({path: '/', component: InboxCmp, name: 'Inbox'}),
- new Route({path: '/drafts', component: DraftsCmp, name: 'Drafts'}),
- new Route({path: '/detail/:id', component: InboxDetailCmp, name: 'DetailPage'})
-])
-export class InboxApp {
- router: Router;
- location: Location;
- constructor(router: Router, location: Location) {
- this.router = router;
- this.location = location;
- }
- inboxPageActive() { return this.location.path() == ''; }
- draftsPageActive() { return this.location.path() == '/drafts'; }
-}
diff --git a/modules/playground/src/routing_deprecated/app/inbox-detail.html b/modules/playground/src/routing_deprecated/app/inbox-detail.html
deleted file mode 100644
index 0766e502cb..0000000000
--- a/modules/playground/src/routing_deprecated/app/inbox-detail.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
{{ record.subject }}
-
-
- ID: {{ record.id }}
- Name: {{ record.firstName }} {{ record.lastName }}
- Email: {{ record.email }}
- Date: {{ record.date }}
-
-
-
- {{ record.content }}
-
-
-
- Back
-
-
-
-
-
- View Latest Messages
-
-
diff --git a/modules/playground/src/routing_deprecated/app/inbox.html b/modules/playground/src/routing_deprecated/app/inbox.html
deleted file mode 100644
index 4568060601..0000000000
--- a/modules/playground/src/routing_deprecated/app/inbox.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
diff --git a/modules/playground/src/routing_deprecated/css/app.css b/modules/playground/src/routing_deprecated/css/app.css
deleted file mode 100644
index 42945f32a4..0000000000
--- a/modules/playground/src/routing_deprecated/css/app.css
+++ /dev/null
@@ -1,57 +0,0 @@
-body {
- background:#eee;
- color:black;
-}
-
-.inbox-list,
-.inbox-list li {
- list-style:none;
- padding:0;
- margin:0;
-}
-
-.inbox-list a {
- padding:5px;
- display:block;
-}
-
-inbox, drafts, inbox-side-menu {
- display:block;
-}
-
-inbox-side-menu .link {
- display:block;
- text-align:center;
- padding:1em;
-}
-
-inbox-side-menu .link.active {
- background:white;
-}
-
-inbox-side-menu .link:hover {
- background:#eee;
-}
-
-inbox-side-menu {
- position:fixed;
- left:0;
- top:0;
- bottom:0;
- width:200px;
- background:#ddd;
-}
-
-inbox-side-menu a {
- display: block;
-}
-
-inbox, drafts, inbox-detail {
- padding:1em;
- margin-left:200px;
-}
-
-inbox-detail {
- display:block;
- margin-left:200px;
-}
diff --git a/modules/playground/src/routing_deprecated/index.html b/modules/playground/src/routing_deprecated/index.html
deleted file mode 100644
index 7d386130be..0000000000
--- a/modules/playground/src/routing_deprecated/index.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- Routing Example
-
-
-
-
-
- Loading...
-
-
-
-
-
diff --git a/modules/playground/src/routing_deprecated/index.ts b/modules/playground/src/routing_deprecated/index.ts
deleted file mode 100644
index 321a7390e4..0000000000
--- a/modules/playground/src/routing_deprecated/index.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-import {HashLocationStrategy, LocationStrategy} from '@angular/common';
-import {bootstrap} from '@angular/platform-browser-dynamic';
-import {ROUTER_PROVIDERS} from '@angular/router-deprecated';
-
-import {InboxApp} from './app/inbox-app';
-
-export function main() {
- bootstrap(
- InboxApp, [ROUTER_PROVIDERS, {provide: LocationStrategy, useClass: HashLocationStrategy}]);
-}