chore: router move import changes
This commit is contained in:
parent
d930ad1816
commit
107016ec12
3
build.sh
3
build.sh
|
@ -41,6 +41,7 @@ for PACKAGE in \
|
|||
platform-server \
|
||||
http \
|
||||
router \
|
||||
router-deprecated \
|
||||
upgrade
|
||||
do
|
||||
SRCDIR=./modules/@angular/${PACKAGE}
|
||||
|
@ -58,8 +59,10 @@ do
|
|||
# safely strips 'readonly' specifier from d.ts files to make them compatible with tsc 1.8
|
||||
if [[ ${TRAVIS} ]]; then
|
||||
find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i -e 's/\(^ *(static |private )*\)*readonly */\1/g'
|
||||
find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i -E 's/^( +)abstract ([[:alnum:]]+\:)/\1\2/g'
|
||||
else
|
||||
find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i '' -e 's/\(^ *(static |private )*\)*readonly */\1/g'
|
||||
find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i '' -E 's/^( +)abstract ([[:alnum:]]+\:)/\1\2/g'
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
@ -125,9 +125,9 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
|||
// API of tsickle for lowering decorators to properties on the class.
|
||||
if (isPresent((<any>typeOrFunc).ctorParameters)) {
|
||||
let ctorParameters = (<any>typeOrFunc).ctorParameters;
|
||||
let paramTypes = ctorParameters.map( ctorParam => ctorParam && ctorParam.type );
|
||||
let paramAnnotations = ctorParameters.map( ctorParam =>
|
||||
ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators) );
|
||||
let paramTypes = ctorParameters.map(ctorParam => ctorParam && ctorParam.type);
|
||||
let paramAnnotations = ctorParameters.map(
|
||||
ctorParam => ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators));
|
||||
return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
|
||||
}
|
||||
|
||||
|
@ -182,9 +182,10 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
|||
if (isPresent((<any>typeOrFunc).propDecorators)) {
|
||||
let propDecorators = (<any>typeOrFunc).propDecorators;
|
||||
let propMetadata = <{[key: string]: any[]}>{};
|
||||
Object.keys(propDecorators).forEach( prop => {
|
||||
propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]);
|
||||
});
|
||||
Object.keys(propDecorators)
|
||||
.forEach(prop => {
|
||||
propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]);
|
||||
});
|
||||
return propMetadata;
|
||||
}
|
||||
|
||||
|
@ -220,7 +221,7 @@ function convertTsickleDecoratorIntoMetadata(decoratorInvocations: any[]): any[]
|
|||
if (!decoratorInvocations) {
|
||||
return [];
|
||||
}
|
||||
return decoratorInvocations.map( decoratorInvocation => {
|
||||
return decoratorInvocations.map(decoratorInvocation => {
|
||||
var decoratorType = decoratorInvocation.type;
|
||||
var annotationCls = decoratorType.annotationCls;
|
||||
var annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import {provide, Component, ComponentRef} from '@angular/core';
|
||||
import {bootstrap} from '@angular/platform-browser-dynamic';
|
||||
import {CanActivate, RouteConfig, ComponentInstruction, ROUTER_DIRECTIVES} from '@angular/router';
|
||||
import {
|
||||
CanActivate,
|
||||
RouteConfig,
|
||||
ComponentInstruction,
|
||||
ROUTER_DIRECTIVES
|
||||
} from '@angular/router-deprecated';
|
||||
import {APP_BASE_HREF} from '@angular/common';
|
||||
|
||||
function checkIfWeHavePermission(instruction: ComponentInstruction) {
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
RouteParams,
|
||||
ComponentInstruction,
|
||||
ROUTER_DIRECTIVES
|
||||
} from '@angular/router';
|
||||
} from '@angular/router-deprecated';
|
||||
import {APP_BASE_HREF} from '@angular/common';
|
||||
|
||||
// #docregion routerCanDeactivate
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import {Component, provide, ComponentRef} from '@angular/core';
|
||||
import {bootstrap} from '@angular/platform-browser-dynamic';
|
||||
import {OnActivate, ComponentInstruction, RouteConfig, ROUTER_DIRECTIVES} from '@angular/router';
|
||||
import {
|
||||
OnActivate,
|
||||
ComponentInstruction,
|
||||
RouteConfig,
|
||||
ROUTER_DIRECTIVES
|
||||
} from '@angular/router-deprecated';
|
||||
import {APP_BASE_HREF} from '@angular/common';
|
||||
|
||||
// #docregion routerOnActivate
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import {Component, Injectable, provide, ComponentRef} from '@angular/core';
|
||||
import {bootstrap} from '@angular/platform-browser-dynamic';
|
||||
import {OnDeactivate, ComponentInstruction, RouteConfig, ROUTER_DIRECTIVES} from '@angular/router';
|
||||
import {
|
||||
OnDeactivate,
|
||||
ComponentInstruction,
|
||||
RouteConfig,
|
||||
ROUTER_DIRECTIVES
|
||||
} from '@angular/router-deprecated';
|
||||
import {APP_BASE_HREF} from '@angular/common';
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
CanReuse,
|
||||
RouteParams,
|
||||
OnReuse
|
||||
} from '@angular/router';
|
||||
} from '@angular/router-deprecated';
|
||||
import {APP_BASE_HREF} from '@angular/common';
|
||||
|
||||
|
||||
|
|
|
@ -445,7 +445,7 @@ var HTTP: string[] = [
|
|||
|
||||
var HTTP_TESTING: string[] = ['MockBackend', 'MockConnection'];
|
||||
|
||||
var ROUTER: string[] = [
|
||||
var ROUTER_DEPRECATED: string[] = [
|
||||
'AsyncRoute',
|
||||
'AuxRoute',
|
||||
'CanActivate',
|
||||
|
@ -468,7 +468,26 @@ var ROUTER: string[] = [
|
|||
'RouterOutlet'
|
||||
];
|
||||
|
||||
var ROUTER_TESTING: string[] = [];
|
||||
var ROUTER_DEPRETACED_TESTING: string[] = [];
|
||||
|
||||
|
||||
var ROUTER: string[] = [
|
||||
'ROUTER_DIRECTIVES',
|
||||
'ROUTER_PROVIDERS',
|
||||
'Route',
|
||||
'Router',
|
||||
'DefaultRouterUrlSerializer',
|
||||
'RouteSegment',
|
||||
'RouteTree',
|
||||
'RouterOutletMap',
|
||||
'RouterUrlSerializer',
|
||||
'Routes',
|
||||
'Tree',
|
||||
'UrlSegment',
|
||||
'UrlTree'
|
||||
];
|
||||
|
||||
var ROUTER_TESTING: string[] = ['ROUTER_FAKE_PROVIDERS'];
|
||||
|
||||
|
||||
var API = {
|
||||
|
@ -480,6 +499,8 @@ var API = {
|
|||
'core/testing': CORE_TESTING,
|
||||
'http': HTTP,
|
||||
'http/testing': HTTP_TESTING,
|
||||
'router-deprecated': ROUTER_DEPRECATED,
|
||||
'router-deprecated/testing': ROUTER_DEPRETACED_TESTING,
|
||||
'router': ROUTER,
|
||||
'router/testing': ROUTER_TESTING,
|
||||
'upgrade': UPGRADE,
|
||||
|
|
|
@ -7,6 +7,8 @@ import * as compiler from '@angular/compiler';
|
|||
import * as compiler_testing from '@angular/compiler/testing';
|
||||
import * as http from '@angular/http';
|
||||
import * as http_testing from '@angular/http/testing';
|
||||
import * as router_deprecated from '@angular/router-deprecated';
|
||||
import * as router_deprecated_testing from '@angular/router-deprecated/testing';
|
||||
import * as router from '@angular/router';
|
||||
import * as router_testing from '@angular/router/testing';
|
||||
import * as upgrade from '@angular/upgrade';
|
||||
|
@ -27,6 +29,8 @@ const LIB_MAP = {
|
|||
'core/testing': core_testing,
|
||||
'http': http,
|
||||
'http/testing': http_testing,
|
||||
'router-deprecated': router_deprecated,
|
||||
'router-deprecated/testing': router_deprecated_testing,
|
||||
'router': router,
|
||||
'router/testing': router_testing,
|
||||
'upgrade': upgrade,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import {Provider, NgZone, APP_INITIALIZER} from '@angular/core';
|
||||
import {PlatformLocation} from '@angular/common';
|
||||
import {WebWorkerPlatformLocation} from './platform_location';
|
||||
import {ROUTER_PROVIDERS_COMMON} from '@angular/router';
|
||||
import {ROUTER_PROVIDERS} from '@angular/router';
|
||||
|
||||
export var WORKER_APP_ROUTER = [
|
||||
ROUTER_PROVIDERS_COMMON,
|
||||
ROUTER_PROVIDERS,
|
||||
/* @ts2dart_Provider */ {provide: PlatformLocation, useClass: WebWorkerPlatformLocation},
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
|
|
|
@ -18,8 +18,8 @@ import {
|
|||
tick,
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import {ROUTER_FAKE_PROVIDERS} from 'angular2/src/alt_router/router_testing_providers';
|
||||
import {ROUTER_DIRECTIVES, Routes, Route} from 'angular2/alt_router';
|
||||
import {ROUTER_FAKE_PROVIDERS} from '@angular/router/testing';
|
||||
import {ROUTER_DIRECTIVES, Routes, Route} from '@angular/router';
|
||||
|
||||
|
||||
import {Component, bind} from '@angular/core';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "@angular/router",
|
||||
"name": "@angular/router-deprecated",
|
||||
"version": "$$ANGULAR_VERSION$$",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
export default {
|
||||
entry: '../../../dist/packages-dist/router/esm/index.js',
|
||||
dest: '../../../dist/packages-dist/router/esm/router.umd.js',
|
||||
entry: '../../../dist/packages-dist/router-deprecated/esm/index.js',
|
||||
dest: '../../../dist/packages-dist/router-deprecated/esm/router-deprecated.umd.js',
|
||||
sourceMap: true,
|
||||
format: 'umd',
|
||||
moduleName: 'ng.router',
|
||||
moduleName: 'ng.router_deprecated',
|
||||
globals: {
|
||||
'@angular/core': 'ng.core',
|
||||
'@angular/common': 'ng.common',
|
||||
|
|
|
@ -30,7 +30,7 @@ import {RouterLink} from './src/directives/router_link';
|
|||
*
|
||||
* ```
|
||||
* import {Component} from '@angular/core';
|
||||
* import {ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig} from '@angular/router';
|
||||
* import {ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig} from '@angular/router-deprecated';
|
||||
*
|
||||
* @Component({directives: [ROUTER_DIRECTIVES]})
|
||||
* @RouteConfig([
|
||||
|
|
|
@ -93,7 +93,8 @@ export var BLANK_ROUTE_DATA = new RouteData();
|
|||
* ```
|
||||
* import {Component} from '@angular/core';
|
||||
* import {bootstrap} from '@angular/platform-browser/browser';
|
||||
* import {Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig} from '@angular/router';
|
||||
* import {Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig} from
|
||||
* '@angular/router-deprecated';
|
||||
*
|
||||
* @Component({directives: [ROUTER_DIRECTIVES]})
|
||||
* @RouteConfig([
|
||||
|
|
|
@ -49,7 +49,7 @@ export abstract class AbstractRoute implements RouteDefinition {
|
|||
*
|
||||
* ### Example
|
||||
* ```
|
||||
* import {RouteConfig, Route} from '@angular/router';
|
||||
* import {RouteConfig, Route} from '@angular/router-deprecated';
|
||||
*
|
||||
* @RouteConfig([
|
||||
* new Route({path: '/home', component: HomeCmp, name: 'HomeCmp' })
|
||||
|
@ -87,7 +87,7 @@ export class Route extends AbstractRoute {
|
|||
*
|
||||
* ### Example
|
||||
* ```
|
||||
* import {RouteConfig, AuxRoute} from '@angular/router';
|
||||
* import {RouteConfig, AuxRoute} from '@angular/router-deprecated';
|
||||
*
|
||||
* @RouteConfig([
|
||||
* new AuxRoute({path: '/home', component: HomeCmp})
|
||||
|
@ -127,7 +127,7 @@ export class AuxRoute extends AbstractRoute {
|
|||
*
|
||||
* ### Example
|
||||
* ```
|
||||
* import {RouteConfig, AsyncRoute} from '@angular/router';
|
||||
* import {RouteConfig, AsyncRoute} from '@angular/router-deprecated';
|
||||
*
|
||||
* @RouteConfig([
|
||||
* new AsyncRoute({path: '/home', loader: () => Promise.resolve(MyLoadedCmp), name:
|
||||
|
@ -166,7 +166,7 @@ export class AsyncRoute extends AbstractRoute {
|
|||
*
|
||||
* ### Example
|
||||
* ```
|
||||
* import {RouteConfig, Route, Redirect} from '@angular/router';
|
||||
* import {RouteConfig, Route, Redirect} from '@angular/router-deprecated';
|
||||
*
|
||||
* @RouteConfig([
|
||||
* new Redirect({path: '/', redirectTo: ['/Home'] }),
|
||||
|
|
|
@ -52,7 +52,7 @@ var _resolveToNull = PromiseWrapper.resolve<Instruction>(null);
|
|||
* ROUTER_DIRECTIVES,
|
||||
* ROUTER_PROVIDERS,
|
||||
* RouteConfig
|
||||
* } from '@angular/router';
|
||||
* } from '@angular/router-deprecated';
|
||||
*
|
||||
* @Component({directives: [ROUTER_DIRECTIVES]})
|
||||
* @RouteConfig([
|
||||
|
|
|
@ -14,7 +14,7 @@ import {PlatformLocation} from '@angular/common';
|
|||
* ROUTER_DIRECTIVES,
|
||||
* ROUTER_PROVIDERS,
|
||||
* RouteConfig
|
||||
* } from '@angular/router';
|
||||
* } from '@angular/router-deprecated';
|
||||
*
|
||||
* @Component({directives: [ROUTER_DIRECTIVES]})
|
||||
* @RouteConfig([
|
||||
|
|
|
@ -24,9 +24,9 @@ import {
|
|||
Route,
|
||||
RouteParams,
|
||||
ComponentInstruction
|
||||
} from '@angular/router';
|
||||
} from '@angular/router-deprecated';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {ResolvedInstruction} from '@angular/router/src/instruction';
|
||||
import {ResolvedInstruction} from '@angular/router-deprecated/src/instruction';
|
||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||
|
||||
let dummyInstruction = new ResolvedInstruction(
|
||||
|
|
|
@ -25,7 +25,7 @@ import {
|
|||
Route,
|
||||
Redirect,
|
||||
AuxRoute
|
||||
} from '../../../router/src/route_config/route_config_decorator';
|
||||
} from '../../src/route_config/route_config_decorator';
|
||||
import {PromiseWrapper} from '../../src/facade/async';
|
||||
import {BaseException, WrappedException} from '../../src/facade/exceptions';
|
||||
import {
|
||||
|
@ -34,7 +34,7 @@ import {
|
|||
RouteParams,
|
||||
Router,
|
||||
ROUTER_DIRECTIVES
|
||||
} from '@angular/router';
|
||||
} from '@angular/router-deprecated';
|
||||
|
||||
import {MockLocationStrategy} from '@angular/common/testing';
|
||||
import {ApplicationRef} from '@angular/core/src/application_ref';
|
||||
|
|
|
@ -14,7 +14,7 @@ import {Location} from '@angular/common';
|
|||
|
||||
import {specs, compile, TEST_ROUTER_PROVIDERS, clickOnElement, getHref} from '../util';
|
||||
|
||||
import {Router, AsyncRoute, Route} from '@angular/router';
|
||||
import {Router, AsyncRoute, Route} from '@angular/router-deprecated';
|
||||
|
||||
import {
|
||||
HelloCmp,
|
||||
|
|
|
@ -15,7 +15,7 @@ import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
|||
|
||||
import {Location} from '@angular/common';
|
||||
import {Component} from '@angular/core';
|
||||
import {Router, ROUTER_DIRECTIVES, Route, AuxRoute, RouteConfig} from '@angular/router';
|
||||
import {Router, ROUTER_DIRECTIVES, Route, AuxRoute, RouteConfig} from '@angular/router-deprecated';
|
||||
import {specs, compile, clickOnElement, getHref} from '../util';
|
||||
import {BaseException} from '../../../src/facade/exceptions';
|
||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
RouteParams,
|
||||
RouteData,
|
||||
ROUTER_DIRECTIVES
|
||||
} from '@angular/router';
|
||||
} from '@angular/router-deprecated';
|
||||
import {PromiseWrapper} from '../../../src/facade/async';
|
||||
import {isPresent} from '../../../src/facade/lang';
|
||||
import {DynamicComponentLoader} from '@angular/core/src/linker/dynamic_component_loader';
|
||||
|
|
|
@ -12,7 +12,7 @@ import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing'
|
|||
|
||||
import {specs, compile, TEST_ROUTER_PROVIDERS, clickOnElement, getHref} from '../util';
|
||||
import {Location} from '@angular/common';
|
||||
import {Router, Route} from '@angular/router';
|
||||
import {Router, Route} from '@angular/router-deprecated';
|
||||
import {
|
||||
HelloCmp,
|
||||
UserCmp,
|
||||
|
|
|
@ -22,24 +22,18 @@ import {
|
|||
ObservableWrapper
|
||||
} from '../../src/facade/async';
|
||||
|
||||
import {Router, RouterOutlet, RouterLink, RouteParams} from '@angular/router';
|
||||
import {Router, RouterOutlet, RouterLink, RouteParams} from '@angular/router-deprecated';
|
||||
import {
|
||||
RouteConfig,
|
||||
Route,
|
||||
AuxRoute,
|
||||
AsyncRoute,
|
||||
Redirect
|
||||
} from '../../../router/src/route_config/route_config_decorator';
|
||||
} from '../../src/route_config/route_config_decorator';
|
||||
|
||||
import {
|
||||
OnActivate,
|
||||
OnDeactivate,
|
||||
OnReuse,
|
||||
CanDeactivate,
|
||||
CanReuse
|
||||
} from '../../../router/src/interfaces';
|
||||
import {CanActivate} from '../../../router/src/lifecycle/lifecycle_annotations';
|
||||
import {ComponentInstruction} from '../../../router/src/instruction';
|
||||
import {OnActivate, OnDeactivate, OnReuse, CanDeactivate, CanReuse} from '../../src/interfaces';
|
||||
import {CanActivate} from '../../src/lifecycle/lifecycle_annotations';
|
||||
import {ComponentInstruction} from '../../src/instruction';
|
||||
|
||||
|
||||
import {TEST_ROUTER_PROVIDERS, RootCmp, compile} from './util';
|
||||
|
|
|
@ -17,14 +17,14 @@ import {provide, Component, Injector, Inject} from '@angular/core';
|
|||
import {Location} from '@angular/common';
|
||||
import {PromiseWrapper, TimerWrapper} from '../../src/facade/async';
|
||||
|
||||
import {Router, RouterOutlet, RouterLink, RouteParams, RouteData} from '@angular/router';
|
||||
import {Router, RouterOutlet, RouterLink, RouteParams, RouteData} from '@angular/router-deprecated';
|
||||
import {
|
||||
RouteConfig,
|
||||
Route,
|
||||
AuxRoute,
|
||||
AsyncRoute,
|
||||
Redirect
|
||||
} from '../../../router/src/route_config/route_config_decorator';
|
||||
} from '../../src/route_config/route_config_decorator';
|
||||
|
||||
import {TEST_ROUTER_PROVIDERS, RootCmp, compile} from './util';
|
||||
|
||||
|
|
|
@ -13,14 +13,14 @@ import {
|
|||
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {Router, RouterOutlet, RouterLink, RouteParams, RouteData} from '@angular/router';
|
||||
import {Router, RouterOutlet, RouterLink, RouteParams, RouteData} from '@angular/router-deprecated';
|
||||
import {
|
||||
RouteConfig,
|
||||
Route,
|
||||
AuxRoute,
|
||||
AsyncRoute,
|
||||
Redirect
|
||||
} from '../../../router/src/route_config/route_config_decorator';
|
||||
} from '../../src/route_config/route_config_decorator';
|
||||
import {Location} from '@angular/common';
|
||||
|
||||
import {TEST_ROUTER_PROVIDERS, RootCmp, compile} from './util';
|
||||
|
|
|
@ -32,8 +32,8 @@ import {
|
|||
RouteConfig,
|
||||
ROUTER_DIRECTIVES,
|
||||
ROUTER_PRIMARY_COMPONENT
|
||||
} from '@angular/router';
|
||||
import {RootRouter} from '@angular/router/src/router';
|
||||
} from '@angular/router-deprecated';
|
||||
import {RootRouter} from '@angular/router-deprecated/src/router';
|
||||
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {By} from '@angular/platform-browser/src/dom/debug/by';
|
||||
|
|
|
@ -11,10 +11,10 @@ import {
|
|||
import {provide, Component} from '@angular/core';
|
||||
import {isBlank} from '../../src/facade/lang';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
import {RootRouter} from '@angular/router/src/router';
|
||||
import {Router, ROUTER_DIRECTIVES, ROUTER_PRIMARY_COMPONENT} from '@angular/router';
|
||||
import {RootRouter} from '@angular/router-deprecated/src/router';
|
||||
import {Router, ROUTER_DIRECTIVES, ROUTER_PRIMARY_COMPONENT} from '@angular/router-deprecated';
|
||||
import {Location} from '@angular/common';
|
||||
import {RouteRegistry} from '@angular/router/src/route_registry';
|
||||
import {RouteRegistry} from '@angular/router-deprecated/src/route_registry';
|
||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||
import {SpyLocation} from '@angular/common/testing';
|
||||
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
|
||||
|
|
|
@ -18,7 +18,7 @@ import {Console} from '@angular/core/src/console';
|
|||
import {provide} from '@angular/core';
|
||||
import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {ROUTER_PROVIDERS, Router, RouteConfig, ROUTER_DIRECTIVES} from '@angular/router';
|
||||
import {ROUTER_PROVIDERS, Router, RouteConfig, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
|
||||
import {ExceptionHandler} from '@angular/core';
|
||||
import {MockLocationStrategy} from '@angular/common/testing';
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
|||
import {PromiseWrapper} from '../src/facade/async';
|
||||
import {Type, IS_DART} from '../src/facade/lang';
|
||||
|
||||
import {RouteRegistry} from '../../router/src/route_registry';
|
||||
import {RouteRegistry} from '../src/route_registry';
|
||||
import {
|
||||
RouteConfig,
|
||||
Route,
|
||||
Redirect,
|
||||
AuxRoute,
|
||||
AsyncRoute
|
||||
} from '../../router/src/route_config/route_config_decorator';
|
||||
} from '../src/route_config/route_config_decorator';
|
||||
|
||||
|
||||
export function main() {
|
||||
|
|
|
@ -14,18 +14,13 @@ import {SpyRouterOutlet} from './spies';
|
|||
import {Type} from '../src/facade/lang';
|
||||
import {PromiseWrapper, ObservableWrapper} from '../src/facade/async';
|
||||
import {ListWrapper} from '../src/facade/collection';
|
||||
import {Router, RootRouter} from '@angular/router/src/router';
|
||||
import {Router, RootRouter} from '../src/router';
|
||||
import {SpyLocation} from '@angular/common/testing';
|
||||
import {Location} from '@angular/common';
|
||||
import {RouteRegistry, ROUTER_PRIMARY_COMPONENT} from '@angular/router/src/route_registry';
|
||||
import {
|
||||
RouteConfig,
|
||||
AsyncRoute,
|
||||
Route,
|
||||
Redirect
|
||||
} from '@angular/router/src/route_config/route_config_decorator';
|
||||
import {RouteRegistry, ROUTER_PRIMARY_COMPONENT} from '../src/route_registry';
|
||||
import {RouteConfig, AsyncRoute, Route, Redirect} from '../src/route_config/route_config_decorator';
|
||||
import {provide} from '@angular/core';
|
||||
import {RouterOutlet} from '@angular/router/src/directives/router_outlet';
|
||||
import {RouterOutlet} from '../src/directives/router_outlet';
|
||||
|
||||
export function main() {
|
||||
describe('Router', () => {
|
||||
|
|
|
@ -8,8 +8,8 @@ import {
|
|||
beforeEach,
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {ParamRoutePath} from '../../../../router/src/rules/route_paths/param_route_path';
|
||||
import {parser, Url} from '../../../../router/src/url_parser';
|
||||
import {ParamRoutePath} from '../../../src/rules/route_paths/param_route_path';
|
||||
import {parser, Url} from '../../../src/url_parser';
|
||||
|
||||
export function main() {
|
||||
describe('PathRecognizer', () => {
|
||||
|
|
|
@ -8,9 +8,9 @@ import {
|
|||
beforeEach,
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {GeneratedUrl} from '../../../../router/src/rules/route_paths/route_path';
|
||||
import {RegexRoutePath} from '../../../../router/src/rules/route_paths/regex_route_path';
|
||||
import {parser, Url} from '../../../../router/src/url_parser';
|
||||
import {GeneratedUrl} from '../../../src/rules/route_paths/route_path';
|
||||
import {RegexRoutePath} from '../../../src/rules/route_paths/regex_route_path';
|
||||
import {parser, Url} from '../../../src/url_parser';
|
||||
|
||||
function emptySerializer(params) {
|
||||
return new GeneratedUrl('', {});
|
||||
|
|
|
@ -8,11 +8,11 @@ import {
|
|||
beforeEach,
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
|
||||
import {RouteMatch, PathMatch, RedirectMatch} from '../../../router/src/rules/rules';
|
||||
import {RuleSet} from '../../../router/src/rules/rule_set';
|
||||
import {GeneratedUrl} from '../../../router/src/rules/route_paths/route_path';
|
||||
import {Route, Redirect} from '../../../router/src/route_config/route_config_decorator';
|
||||
import {parser} from '../../../router/src/url_parser';
|
||||
import {RouteMatch, PathMatch, RedirectMatch} from '../../src/rules/rules';
|
||||
import {RuleSet} from '../../src/rules/rule_set';
|
||||
import {GeneratedUrl} from '../../src/rules/route_paths/route_path';
|
||||
import {Route, Redirect} from '../../src/route_config/route_config_decorator';
|
||||
import {parser} from '../../src/url_parser';
|
||||
import {PromiseWrapper} from '../../src/facade/promise';
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Location} from '@angular/common';
|
||||
import {Router, RouterOutlet} from '@angular/router';
|
||||
import {Router, RouterOutlet} from '@angular/router-deprecated';
|
||||
import {SpyObject, proxy} from '@angular/core/testing/testing_internal';
|
||||
|
||||
export class SpyRouter extends SpyObject {
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
beforeEach,
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {UrlParser, Url} from '../../router/src/url_parser';
|
||||
import {UrlParser, Url} from '../src/url_parser';
|
||||
|
||||
|
||||
export function main() {
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
"experimentalDecorators": true,
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../../../dist/packages-dist/router/esm",
|
||||
"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/"]
|
||||
"@angular/core": ["../../../dist/packages-dist/core"],
|
||||
"@angular/common": ["../../../dist/packages-dist/common"],
|
||||
"@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"]
|
||||
},
|
||||
"rootDir": ".",
|
||||
"sourceMap": true,
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
"experimentalDecorators": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../../../dist/packages-dist/router/",
|
||||
"outDir": "../../../dist/packages-dist/router-deprecated/",
|
||||
"paths": {
|
||||
"@angular/core": ["../../../dist/packages-dist/core/"],
|
||||
"@angular/common": ["../../../dist/packages-dist/common/"],
|
||||
"@angular/core": ["../../../dist/packages-dist/core"],
|
||||
"@angular/common": ["../../../dist/packages-dist/common"],
|
||||
"@angular/platform-browser": ["../../../dist/packages-dist/platform-browser/"]
|
||||
},
|
||||
"rootDir": ".",
|
||||
|
|
|
@ -4,18 +4,15 @@
|
|||
* Alternative implementation of the router. Experimental.
|
||||
*/
|
||||
|
||||
export {Router, RouterOutletMap} from './src/alt_router/router';
|
||||
export {RouteSegment, UrlSegment, Tree, UrlTree, RouteTree} from './src/alt_router/segments';
|
||||
export {Routes} from './src/alt_router/metadata/decorators';
|
||||
export {Route} from './src/alt_router/metadata/metadata';
|
||||
export {
|
||||
RouterUrlSerializer,
|
||||
DefaultRouterUrlSerializer
|
||||
} from './src/alt_router/router_url_serializer';
|
||||
export {OnActivate, CanDeactivate} from './src/alt_router/interfaces';
|
||||
export {ROUTER_PROVIDERS} from './src/alt_router/router_providers';
|
||||
export {Router, RouterOutletMap} from './src/router';
|
||||
export {RouteSegment, UrlSegment, Tree, UrlTree, RouteTree} from './src/segments';
|
||||
export {Routes} from './src/metadata/decorators';
|
||||
export {Route} from './src/metadata/metadata';
|
||||
export {RouterUrlSerializer, DefaultRouterUrlSerializer} from './src/router_url_serializer';
|
||||
export {OnActivate, CanDeactivate} from './src/interfaces';
|
||||
export {ROUTER_PROVIDERS} from './src/router_providers';
|
||||
|
||||
import {RouterOutlet} from './src/alt_router/directives/router_outlet';
|
||||
import {RouterLink} from './src/alt_router/directives/router_link';
|
||||
import {RouterOutlet} from './src/directives/router_outlet';
|
||||
import {RouterLink} from './src/directives/router_link';
|
||||
|
||||
export const ROUTER_DIRECTIVES: any[] = /*@ts2dart_const*/[RouterOutlet, RouterLink];
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "@angular/router",
|
||||
"version": "$$ANGULAR_VERSION$$",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"jsnext:main": "esm/index.js",
|
||||
"typins": "index.d.ts",
|
||||
"author": "angular",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@angular/core": "$$ANGULAR_VERSION$$",
|
||||
"@angular/common": "$$ANGULAR_VERSION$$",
|
||||
"@angular/platform-browser": "$$ANGULAR_VERSION$$"
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
export './platform-browser.dart' show DomAdapter, setRootDomAdapter;
|
|
@ -0,0 +1,4 @@
|
|||
import {__platform_browser_private__ as _} from '@angular/platform-browser';
|
||||
|
||||
export type DomAdapter = typeof _.DomAdapter;
|
||||
export var getDOM: typeof _.getDOM = _.getDOM;
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
export default {
|
||||
entry: '../../../dist/packages-dist/router/esm/index.js',
|
||||
dest: '../../../dist/packages-dist/router/esm/router.umd.js',
|
||||
sourceMap: true,
|
||||
format: 'umd',
|
||||
moduleName: 'ng.router',
|
||||
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 }),
|
||||
]
|
||||
}
|
|
@ -16,8 +16,8 @@ import {
|
|||
} from '@angular/core';
|
||||
import {RouterOutletMap, Router} from '../router';
|
||||
import {RouteSegment, UrlSegment, Tree} from '../segments';
|
||||
import {isString, isPresent} from '@angular/facade/src/lang';
|
||||
import {ObservableWrapper} from '@angular/facade/src/async';
|
||||
import {isString, isPresent} from '../facade/lang';
|
||||
import {ObservableWrapper} from '../facade/async';
|
||||
|
||||
@Directive({selector: '[routerLink]'})
|
||||
export class RouterLink implements OnDestroy {
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
} from '@angular/core';
|
||||
import {RouterOutletMap} from '../router';
|
||||
import {DEFAULT_OUTLET_NAME} from '../constants';
|
||||
import {isPresent, isBlank} from '@angular/facade/src/lang';
|
||||
import {isPresent, isBlank} from '../facade/lang';
|
||||
|
||||
@Directive({selector: 'router-outlet'})
|
||||
export class RouterOutlet {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
../../facade/src
|
|
@ -1,4 +1,4 @@
|
|||
import {Type, isBlank} from '@angular/facade/src/lang';
|
||||
import {Type, isBlank} from './facade/lang';
|
||||
|
||||
export function hasLifecycleHook(name: string, obj: Object): boolean {
|
||||
if (isBlank(obj)) return false;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {Tree, TreeNode, UrlSegment, RouteSegment, rootNode, UrlTree, RouteTree} from './segments';
|
||||
import {isBlank, isPresent, isString, isStringMap} from '@angular/facade/src/lang';
|
||||
import {ListWrapper} from '@angular/facade/src/collection';
|
||||
import {isBlank, isPresent, isString, isStringMap} from './facade/lang';
|
||||
import {ListWrapper} from './facade/collection';
|
||||
|
||||
export function link(segment: RouteSegment, routeTree: RouteTree, urlTree: UrlTree,
|
||||
change: any[]): UrlTree {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import {Type, stringify} from "@angular/facade/src/lang";
|
||||
import {Type} from '@angular/core';
|
||||
import {stringify} from "../facade/lang";
|
||||
|
||||
export abstract class RouteMetadata {
|
||||
abstract get path(): string;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import {RouteSegment, UrlSegment, Tree, TreeNode, rootNode, UrlTree, RouteTree} from './segments';
|
||||
import {RoutesMetadata, RouteMetadata} from './metadata/metadata';
|
||||
import {Type, isBlank, isPresent, stringify} from '@angular/facade/src/lang';
|
||||
import {ListWrapper, StringMapWrapper} from '@angular/facade/src/collection';
|
||||
import {PromiseWrapper} from '@angular/facade/src/promise';
|
||||
import {Type, isBlank, isPresent, stringify} from './facade/lang';
|
||||
import {ListWrapper, StringMapWrapper} from './facade/collection';
|
||||
import {PromiseWrapper} from './facade/promise';
|
||||
import {BaseException} from '@angular/core';
|
||||
import {ComponentResolver} from '@angular/core';
|
||||
import {DEFAULT_OUTLET_NAME} from './constants';
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
import {OnInit, provide, ReflectiveInjector, ComponentResolver} from '@angular/core';
|
||||
import {RouterOutlet} from './directives/router_outlet';
|
||||
import {Type, isBlank, isPresent} from '@angular/facade/src/lang';
|
||||
import {ListWrapper} from '@angular/facade/src/collection';
|
||||
import {
|
||||
EventEmitter,
|
||||
Observable,
|
||||
PromiseWrapper,
|
||||
ObservableWrapper
|
||||
} from '@angular/facade/src/async';
|
||||
import {StringMapWrapper} from '@angular/facade/src/collection';
|
||||
import {Type, isBlank, isPresent} from './facade/lang';
|
||||
import {ListWrapper} from './facade/collection';
|
||||
import {EventEmitter, Observable, PromiseWrapper, ObservableWrapper} from './facade/async';
|
||||
import {StringMapWrapper} from './facade/collection';
|
||||
import {BaseException} from '@angular/core';
|
||||
import {RouterUrlSerializer} from './router_url_serializer';
|
||||
import {CanDeactivate} from './interfaces';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {UrlSegment, Tree, TreeNode, rootNode, UrlTree} from './segments';
|
||||
import {BaseException} from '@angular/core';
|
||||
import {isBlank, isPresent, RegExpWrapper} from '@angular/facade/src/lang';
|
||||
import {isBlank, isPresent, RegExpWrapper} from './facade/lang';
|
||||
|
||||
export abstract class RouterUrlSerializer {
|
||||
abstract parse(url: string): UrlTree;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {ComponentFactory, Type} from '@angular/core';
|
||||
import {StringMapWrapper, ListWrapper} from '@angular/facade/src/collection';
|
||||
import {isBlank, isPresent, stringify} from '@angular/facade/src/lang';
|
||||
import {StringMapWrapper, ListWrapper} from './facade/collection';
|
||||
import {isBlank, isPresent, stringify} from './facade/lang';
|
||||
|
||||
export class Tree<T> {
|
||||
/** @internal */
|
||||
|
|
|
@ -1,23 +1,20 @@
|
|||
import {
|
||||
ComponentFixture,
|
||||
AsyncTestCompleter,
|
||||
TestComponentBuilder,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
xdescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
beforeEachProviders,
|
||||
it,
|
||||
xit,
|
||||
fakeAsync,
|
||||
tick
|
||||
} from 'angular2/testing_internal';
|
||||
import {provide, Component, ComponentResolver} from 'angular2/core';
|
||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||
xit
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
import {fakeAsync, tick} from '@angular/core/testing';
|
||||
import {ComponentFixture, TestComponentBuilder} from '@angular/compiler/testing';
|
||||
import {provide, Component, ComponentResolver} from '@angular/core';
|
||||
import {PromiseWrapper} from '../src/facade/async';
|
||||
|
||||
|
||||
import {
|
||||
|
@ -31,10 +28,10 @@ import {
|
|||
DefaultRouterUrlSerializer,
|
||||
OnActivate,
|
||||
CanDeactivate
|
||||
} from 'angular2/alt_router';
|
||||
import {SpyLocation} from 'angular2/src/mock/location_mock';
|
||||
import {Location} from 'angular2/platform/common';
|
||||
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
||||
} from '@angular/router';
|
||||
import {SpyLocation} from '@angular/common/testing';
|
||||
import {Location} from '@angular/common';
|
||||
import {getDOM} from '../platform_browser_private';
|
||||
|
||||
export function main() {
|
||||
describe('navigation', () => {
|
||||
|
@ -155,7 +152,7 @@ export function main() {
|
|||
expect(location.path()).toEqual('/team/22/cannotDeactivate');
|
||||
})));
|
||||
|
||||
if (DOM.supportsDOMEvents()) {
|
||||
if (getDOM().supportsDOMEvents()) {
|
||||
it("should support absolute router links",
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router, tcb) => {
|
||||
let fixture = tcb.createFakeAsync(RootCmp);
|
||||
|
@ -165,9 +162,9 @@ export function main() {
|
|||
advance(fixture);
|
||||
expect(fixture.debugElement.nativeElement).toHaveText('team 22 { link, aux: }');
|
||||
|
||||
let native = DOM.querySelector(fixture.debugElement.nativeElement, "a");
|
||||
expect(DOM.getAttribute(native, "href")).toEqual("/team/33/simple");
|
||||
DOM.dispatchEvent(native, DOM.createMouseEvent('click'));
|
||||
let native = getDOM().querySelector(fixture.debugElement.nativeElement, "a");
|
||||
expect(getDOM().getAttribute(native, "href")).toEqual("/team/33/simple");
|
||||
getDOM().dispatchEvent(native, getDOM().createMouseEvent('click'));
|
||||
advance(fixture);
|
||||
|
||||
expect(fixture.debugElement.nativeElement).toHaveText('team 33 { simple, aux: }');
|
||||
|
@ -183,9 +180,9 @@ export function main() {
|
|||
expect(fixture.debugElement.nativeElement)
|
||||
.toHaveText('team 22 { relativelink { }, aux: }');
|
||||
|
||||
let native = DOM.querySelector(fixture.debugElement.nativeElement, "a");
|
||||
expect(DOM.getAttribute(native, "href")).toEqual("/team/22/relativelink/simple");
|
||||
DOM.dispatchEvent(native, DOM.createMouseEvent('click'));
|
||||
let native = getDOM().querySelector(fixture.debugElement.nativeElement, "a");
|
||||
expect(getDOM().getAttribute(native, "href")).toEqual("/team/22/relativelink/simple");
|
||||
getDOM().dispatchEvent(native, getDOM().createMouseEvent('click'));
|
||||
advance(fixture);
|
||||
|
||||
expect(fixture.debugElement.nativeElement)
|
||||
|
@ -201,13 +198,13 @@ export function main() {
|
|||
advance(fixture);
|
||||
expect(fixture.debugElement.nativeElement)
|
||||
.toHaveText('team 22 { relativelink { }, aux: }');
|
||||
let link = DOM.querySelector(fixture.debugElement.nativeElement, "a");
|
||||
expect(DOM.hasClass(link, "router-link-active")).toEqual(false);
|
||||
let link = getDOM().querySelector(fixture.debugElement.nativeElement, "a");
|
||||
expect(getDOM().hasClass(link, "router-link-active")).toEqual(false);
|
||||
|
||||
DOM.dispatchEvent(link, DOM.createMouseEvent('click'));
|
||||
getDOM().dispatchEvent(link, getDOM().createMouseEvent('click'));
|
||||
advance(fixture);
|
||||
|
||||
expect(DOM.hasClass(link, "router-link-active")).toEqual(true);
|
||||
expect(getDOM().hasClass(link, "router-link-active")).toEqual(true);
|
||||
})));
|
||||
|
||||
it("should update router links when router changes",
|
||||
|
@ -219,13 +216,13 @@ export function main() {
|
|||
advance(fixture);
|
||||
expect(fixture.debugElement.nativeElement).toHaveText('team 22 { link, aux: simple }');
|
||||
|
||||
let native = DOM.querySelector(fixture.debugElement.nativeElement, "a");
|
||||
expect(DOM.getAttribute(native, "href")).toEqual("/team/33/simple(aux:simple)");
|
||||
let native = getDOM().querySelector(fixture.debugElement.nativeElement, "a");
|
||||
expect(getDOM().getAttribute(native, "href")).toEqual("/team/33/simple(aux:simple)");
|
||||
|
||||
router.navigateByUrl('/team/22/link(simple2)');
|
||||
advance(fixture);
|
||||
|
||||
expect(DOM.getAttribute(native, "href")).toEqual("/team/33/simple(aux:simple2)");
|
||||
expect(getDOM().getAttribute(native, "href")).toEqual("/team/33/simple(aux:simple2)");
|
||||
})));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,29 +1,20 @@
|
|||
import {
|
||||
ComponentFixture,
|
||||
AsyncTestCompleter,
|
||||
TestComponentBuilder,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
xdescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
beforeEachProviders,
|
||||
it,
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {
|
||||
RouteSegment,
|
||||
UrlSegment,
|
||||
UrlTree,
|
||||
TreeNode,
|
||||
RouteTree
|
||||
} from 'angular2/src/alt_router/segments';
|
||||
import {link} from 'angular2/src/alt_router/link';
|
||||
import {DefaultRouterUrlSerializer} from 'angular2/src/alt_router/router_url_serializer';
|
||||
import {RouteSegment, UrlSegment, UrlTree, TreeNode, RouteTree} from '../src/segments';
|
||||
import {link} from '../src/link';
|
||||
import {DefaultRouterUrlSerializer} from '../src/router_url_serializer';
|
||||
|
||||
export function main() {
|
||||
describe('link', () => {
|
||||
|
@ -105,4 +96,4 @@ export function main() {
|
|||
function s(u: UrlSegment): RouteTree {
|
||||
let root = new TreeNode<RouteSegment>(new RouteSegment([u], {}, null, null, null), []);
|
||||
return new RouteTree(root);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,23 @@
|
|||
import {
|
||||
ComponentFixture,
|
||||
AsyncTestCompleter,
|
||||
TestComponentBuilder,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
xdescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
beforeEachProviders,
|
||||
it,
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {recognize} from 'angular2/src/alt_router/recognize';
|
||||
import {Routes, Route} from 'angular2/alt_router';
|
||||
import {provide, Component, ComponentResolver} from 'angular2/core';
|
||||
import {UrlSegment, RouteTree, UrlTree} from 'angular2/src/alt_router/segments';
|
||||
import {DefaultRouterUrlSerializer} from 'angular2/src/alt_router/router_url_serializer';
|
||||
import {DEFAULT_OUTLET_NAME} from 'angular2/src/alt_router/constants';
|
||||
import {recognize} from '../src/recognize';
|
||||
import {Routes, Route} from '@angular/router';
|
||||
import {provide, Component, ComponentResolver} from '@angular/core';
|
||||
import {UrlSegment, RouteTree, UrlTree} from '../src/segments';
|
||||
import {DefaultRouterUrlSerializer} from '../src/router_url_serializer';
|
||||
import {DEFAULT_OUTLET_NAME} from '../src/constants';
|
||||
|
||||
export function main() {
|
||||
describe('recognize', () => {
|
||||
|
@ -241,4 +238,4 @@ class ComponentG {
|
|||
new Route({path: "f", component: ComponentF})
|
||||
])
|
||||
class ComponentA {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
import {
|
||||
ComponentFixture,
|
||||
AsyncTestCompleter,
|
||||
TestComponentBuilder,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
xdescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
beforeEachProviders,
|
||||
it,
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {DefaultRouterUrlSerializer} from 'angular2/src/alt_router/router_url_serializer';
|
||||
import {UrlSegment} from 'angular2/src/alt_router/segments';
|
||||
import {DefaultRouterUrlSerializer} from '../src/router_url_serializer';
|
||||
import {UrlSegment} from '../src/segments';
|
||||
|
||||
export function main() {
|
||||
describe('url serializer', () => {
|
||||
|
@ -111,4 +108,4 @@ export function main() {
|
|||
|
||||
function expectSegment(segment: UrlSegment, expected: string): void {
|
||||
expect(segment.toString()).toEqual(expected);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
import {
|
||||
ComponentFixture,
|
||||
AsyncTestCompleter,
|
||||
TestComponentBuilder,
|
||||
beforeEach,
|
||||
ddescribe,
|
||||
xdescribe,
|
||||
describe,
|
||||
el,
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
beforeEachProviders,
|
||||
it,
|
||||
xit
|
||||
} from 'angular2/testing_internal';
|
||||
} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {Tree, TreeNode} from 'angular2/src/alt_router/segments';
|
||||
import {Tree, TreeNode} from '../src/segments';
|
||||
|
||||
export function main() {
|
||||
describe('tree', () => {
|
||||
|
@ -66,4 +63,4 @@ export function main() {
|
|||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
export * from './testing/router_testing_providers';
|
|
@ -1,7 +1,7 @@
|
|||
import {SpyLocation} from '@angular/common/testing';
|
||||
import {Location} from '@angular/common';
|
||||
import {Router, RouterOutletMap} from './router';
|
||||
import {RouterUrlSerializer, DefaultRouterUrlSerializer} from './router_url_serializer';
|
||||
import {Router, RouterOutletMap} from '../src/router';
|
||||
import {RouterUrlSerializer, DefaultRouterUrlSerializer} from '../src/router_url_serializer';
|
||||
import {Component, ComponentResolver} from '@angular/core';
|
||||
|
||||
@Component({selector: 'fake-app-root-comp', template: `<span></span>`})
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"angularCompilerOptions": {
|
||||
"skipTemplateCodegen": true
|
||||
},
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"declaration": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../../../dist/packages-dist/router/esm",
|
||||
"paths": {
|
||||
"@angular/core": ["../../../dist/packages-dist/core/"],
|
||||
"@angular/common": ["../../../dist/packages-dist/common/"],
|
||||
"@angular/common/testing": ["../../../dist/packages-dist/common/testing/"],
|
||||
"@angular/platform-browser": ["../../../dist/packages-dist/platform-browser/"]
|
||||
},
|
||||
"rootDir": ".",
|
||||
"sourceMap": true,
|
||||
"sourceRoot": ".",
|
||||
"target": "es2015"
|
||||
},
|
||||
"files": [
|
||||
"index.ts",
|
||||
"testing.ts",
|
||||
"../../../node_modules/zone.js/dist/zone.js.d.ts"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"angularCompilerOptions": {
|
||||
"skipTemplateCodegen": true
|
||||
},
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"declaration": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../../../dist/packages-dist/router/",
|
||||
"paths": {
|
||||
"@angular/core": ["../../../dist/packages-dist/core/"],
|
||||
"@angular/common": ["../../../dist/packages-dist/common/"],
|
||||
"@angular/common/testing": ["../../../dist/packages-dist/common/testing/"],
|
||||
"@angular/platform-browser": ["../../../dist/packages-dist/platform-browser/"]
|
||||
},
|
||||
"rootDir": ".",
|
||||
"sourceMap": true,
|
||||
"sourceRoot": ".",
|
||||
"target": "es5"
|
||||
},
|
||||
"files": [
|
||||
"index.ts",
|
||||
"testing.ts",
|
||||
"../typings/es6-collections/es6-collections.d.ts",
|
||||
"../typings/es6-promise/es6-promise.d.ts",
|
||||
"../manual_typings/globals.d.ts",
|
||||
"../../../node_modules/zone.js/dist/zone.js.d.ts"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
library playground.e2e_test.routing.routing_spec;
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,91 @@
|
|||
import {verifyNoBrowserErrors} from '@angular/platform-browser/testing_e2e';
|
||||
|
||||
function waitForElement(selector) {
|
||||
var EC = (<any>protractor).ExpectedConditions;
|
||||
// Waits for the element with id 'abc' to be present on the dom.
|
||||
browser.wait(EC.presenceOf($(selector)), 20000);
|
||||
}
|
||||
|
||||
describe('alt-routing inbox-app', () => {
|
||||
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
|
||||
describe('index view', () => {
|
||||
var URL = 'all/playground/src/alt_routing/';
|
||||
|
||||
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/alt_routing/#/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/alt_routing/';
|
||||
|
||||
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");
|
||||
});
|
||||
})
|
||||
});
|
|
@ -9,7 +9,7 @@ import {
|
|||
RouteSegment,
|
||||
RouteTree,
|
||||
UrlTree
|
||||
} from 'angular2/alt_router';
|
||||
} from '@angular/router';
|
||||
import * as db from './data';
|
||||
import {Location} from '@angular/common';
|
||||
import {PromiseWrapper} from '@angular/core/src/facade/async';
|
||||
|
|
|
@ -25,55 +25,36 @@ declare var System: any;
|
|||
'@angular/common': '/packages-dist/common/common.umd.js',
|
||||
'@angular/compiler': '/packages-dist/compiler/compiler.umd.js',
|
||||
'@angular/platform-browser': '/packages-dist/platform-browser/platform-browser.umd.js',
|
||||
'@angular/platform-browser-dynamic': '/packages-dist/platform-browser-dynamic/platform-browser-dynamic.umd.js',
|
||||
'@angular/platform-browser-dynamic':
|
||||
'/packages-dist/platform-browser-dynamic/platform-browser-dynamic.umd.js',
|
||||
'@angular/http': '/packages-dist/http/http.umd.js',
|
||||
'@angular/upgrade': '/packages-dist/upgrade/upgrade.umd.js',
|
||||
'@angular/router': '/packages-dist/router/router.umd.js',
|
||||
'@angular/router-deprecated': '/packages-dist/router-deprecated/router-deprecated.umd.js',
|
||||
'@angular/core/src/facade': '/all/@angular/core/src/facade',
|
||||
'rxjs': location.pathname.replace(/index\.html$/, '') + 'rxjs'
|
||||
},
|
||||
packages: {
|
||||
'app': {
|
||||
defaultExtension: 'js'
|
||||
},
|
||||
'@angular/core/src/facade': {
|
||||
defaultExtension: 'js'
|
||||
}
|
||||
'app': {defaultExtension: 'js'},
|
||||
'@angular/core/src/facade': {defaultExtension: 'js'}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.warn("Not using the Angular bundles. Don't use this configuration for e2e/performance tests!");
|
||||
console.warn(
|
||||
"Not using the Angular bundles. Don't use this configuration for e2e/performance tests!");
|
||||
|
||||
System.config({
|
||||
map: {
|
||||
'index': 'index.js',
|
||||
'@angular': '/all/@angular'
|
||||
},
|
||||
map: {'index': 'index.js', '@angular': '/all/@angular'},
|
||||
packages: {
|
||||
// 'app': {
|
||||
// main: 'index.js',
|
||||
// defaultExtension: 'js'
|
||||
// },
|
||||
'@angular/core': {
|
||||
main: 'index.js',
|
||||
defaultExtension: 'js'
|
||||
},
|
||||
'@angular/compiler': {
|
||||
main: 'index.js',
|
||||
defaultExtension: 'js'
|
||||
},
|
||||
'@angular/common': {
|
||||
main: 'index.js',
|
||||
defaultExtension: 'js'
|
||||
},
|
||||
'@angular/platform-browser': {
|
||||
main: 'index.js',
|
||||
defaultExtension: 'js'
|
||||
},
|
||||
'@angular/platform-browser-dynamic': {
|
||||
main: 'index.js',
|
||||
defaultExtension: 'js'
|
||||
}
|
||||
'@angular/core': {main: 'index.js', defaultExtension: 'js'},
|
||||
'@angular/compiler': {main: 'index.js', defaultExtension: 'js'},
|
||||
'@angular/common': {main: 'index.js', defaultExtension: 'js'},
|
||||
'@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'},
|
||||
'@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'}
|
||||
// 'rxjs': {
|
||||
// defaultExtension: 'js'
|
||||
// }
|
||||
|
@ -83,9 +64,7 @@ declare var System: any;
|
|||
|
||||
|
||||
// BOOTSTRAP the app!
|
||||
System.import('index').then(function (m) {
|
||||
m.main();
|
||||
}, console.error.bind(console));
|
||||
System.import('index').then(function(m) { m.main(); }, console.error.bind(console));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {Component, provide} from '@angular/core';
|
||||
import {bootstrap} from '@angular/platform-browser-dynamic';
|
||||
import {RouteConfig, Route, ROUTER_PROVIDERS, ROUTER_DIRECTIVES} from '@angular/router';
|
||||
import {RouteConfig, Route, ROUTER_PROVIDERS, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
|
||||
import {HashLocationStrategy, LocationStrategy} from '@angular/common';
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
import {Component, Injectable} from '@angular/core';
|
||||
import {RouterLink, RouteConfig, Router, Route, RouterOutlet, RouteParams} from '@angular/router';
|
||||
import {
|
||||
RouterLink,
|
||||
RouteConfig,
|
||||
Router,
|
||||
Route,
|
||||
RouterOutlet,
|
||||
RouteParams
|
||||
} from '@angular/router-deprecated';
|
||||
import * as db from './data';
|
||||
import {Location} from '@angular/common';
|
||||
import {PromiseWrapper, PromiseCompleter} from '@angular/core/src/facade/async';
|
||||
|
@ -81,7 +88,8 @@ class DbService {
|
|||
}
|
||||
}
|
||||
|
||||
@Component({selector: 'inbox-detail', directives: [RouterLink], templateUrl: 'app/inbox-detail.html'})
|
||||
@Component(
|
||||
{selector: 'inbox-detail', directives: [RouterLink], templateUrl: 'app/inbox-detail.html'})
|
||||
class InboxDetailCmp {
|
||||
record: InboxRecord = new InboxRecord();
|
||||
ready: boolean = false;
|
||||
|
|
|
@ -2,7 +2,7 @@ import {InboxApp} from './app/inbox-app';
|
|||
import {provide} from '@angular/core';
|
||||
import {bootstrap} from '@angular/platform-browser-dynamic';
|
||||
import {HashLocationStrategy, LocationStrategy} from '@angular/common';
|
||||
import {ROUTER_PROVIDERS} from '@angular/router';
|
||||
import {ROUTER_PROVIDERS} from '@angular/router-deprecated';
|
||||
|
||||
export function main() {
|
||||
bootstrap(InboxApp,
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import {PromiseWrapper} from '@angular/core/src/facade/async';
|
||||
import {Component} from '@angular/core';
|
||||
import {
|
||||
ServiceMessageBrokerFactory,
|
||||
PRIMITIVE
|
||||
} from '@angular/platform-browser/src/worker_app';;
|
||||
import {ServiceMessageBrokerFactory, PRIMITIVE} from '@angular/platform-browser/src/worker_app';
|
||||
;
|
||||
|
||||
const ECHO_CHANNEL = "ECHO";
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import {Component} from '@angular/core';
|
|||
import {Start} from './components/start';
|
||||
import {About} from './components/about';
|
||||
import {Contact} from './components/contact';
|
||||
import {ROUTER_DIRECTIVES, RouteConfig, Route} from '@angular/router';
|
||||
import {ROUTER_DIRECTIVES, RouteConfig, Route} from '@angular/router-deprecated';
|
||||
|
||||
@Component({selector: 'app', directives: [ROUTER_DIRECTIVES], templateUrl: 'app.html'})
|
||||
@RouteConfig([
|
||||
|
|
|
@ -19,7 +19,6 @@ exports.config = {
|
|||
'dist/all/**/e2e_test/**/*_spec.js'
|
||||
],
|
||||
exclude: [
|
||||
'**/alt_routing/**', // temporary package
|
||||
'**/web_workers/**', // needs to be setup
|
||||
'**/key_events/**', // can't tell why this is failing
|
||||
'**/sourcemap/**' // fails only on travis
|
||||
|
|
|
@ -17,8 +17,7 @@ System.config({
|
|||
'parse5/index': 'dist/all/empty.js',
|
||||
'@angular/platform-server/src/parse5_adapter': 'dist/all/empty.js',
|
||||
'angular2/*': 'dist/all/angular2/*.js',
|
||||
'angular2/src/alt_router/router_testing_providers': 'dist/all/angular2/src/alt_router/router_testing_providers.js',
|
||||
'angular2/alt_router': 'dist/all/angular2/alt_router.js'
|
||||
'angular2/src/alt_router/router_testing_providers': 'dist/all/angular2/src/alt_router/router_testing_providers.js'
|
||||
},
|
||||
packages: {
|
||||
'@angular/core': {
|
||||
|
@ -42,6 +41,10 @@ System.config({
|
|||
main: 'index.js',
|
||||
defaultExtension: 'js'
|
||||
},
|
||||
'@angular/router-deprecated': {
|
||||
main: 'index.js',
|
||||
defaultExtension: 'js'
|
||||
},
|
||||
'@angular/http': {
|
||||
main: 'index.js',
|
||||
defaultExtension: 'js'
|
||||
|
|
Loading…
Reference in New Issue