chore: adjust formatting to new clang-format.
- fixes wrapping for object literal keys called `template`. - spacing in destructuring expressions. - changes to keep trailing return types of functions closer to their function declaration. - better formatting of string literals. Closes #4828
This commit is contained in:
parent
4a1b873fad
commit
c02f2bdab0
|
@ -18,9 +18,9 @@ export {
|
|||
} from './application_ref';
|
||||
|
||||
/// See [commonBootstrap] for detailed documentation.
|
||||
export function bootstrap(appComponentType: /*Type*/ any,
|
||||
appProviders: Array<Type | Provider | any[]> = null):
|
||||
Promise<ComponentRef> {
|
||||
export function bootstrap(
|
||||
appComponentType: /*Type*/ any,
|
||||
appProviders: Array<Type | Provider | any[]> = null): Promise<ComponentRef> {
|
||||
var providers = [compilerProviders()];
|
||||
if (isPresent(appProviders)) {
|
||||
providers.push(appProviders);
|
||||
|
|
|
@ -218,9 +218,9 @@ export function platform(providers?: Array<Type | Provider | any[]>): PlatformRe
|
|||
*
|
||||
* Returns a `Promise` of {@link ComponentRef}.
|
||||
*/
|
||||
export function commonBootstrap(appComponentType: /*Type*/ any,
|
||||
appProviders: Array<Type | Provider | any[]> = null):
|
||||
Promise<ComponentRef> {
|
||||
export function commonBootstrap(
|
||||
appComponentType: /*Type*/ any,
|
||||
appProviders: Array<Type | Provider | any[]> = null): Promise<ComponentRef> {
|
||||
var p = platform();
|
||||
var bindings = [applicationCommonProviders(), applicationDomProviders()];
|
||||
if (isPresent(appProviders)) {
|
||||
|
|
|
@ -203,8 +203,8 @@ export abstract class PlatformRef {
|
|||
* new application. Once this promise resolves, the application will be
|
||||
* constructed in the same manner as a normal `application()`.
|
||||
*/
|
||||
abstract asyncApplication(bindingFn: (zone: NgZone) => Promise<Array<Type | Provider | any[]>>):
|
||||
Promise<ApplicationRef>;
|
||||
abstract asyncApplication(bindingFn: (zone: NgZone) =>
|
||||
Promise<Array<Type | Provider | any[]>>): Promise<ApplicationRef>;
|
||||
|
||||
/**
|
||||
* Destroy the Angular platform and all Angular applications on the page.
|
||||
|
@ -228,8 +228,8 @@ export class PlatformRef_ extends PlatformRef {
|
|||
return app;
|
||||
}
|
||||
|
||||
asyncApplication(bindingFn: (zone: NgZone) =>
|
||||
Promise<Array<Type | Provider | any[]>>): Promise<ApplicationRef> {
|
||||
asyncApplication(bindingFn: (zone: NgZone) => Promise<Array<Type | Provider | any[]>>):
|
||||
Promise<ApplicationRef> {
|
||||
var zone = createNgZone();
|
||||
var completer = PromiseWrapper.completer();
|
||||
zone.run(() => {
|
||||
|
@ -314,8 +314,8 @@ export abstract class ApplicationRef {
|
|||
* app.bootstrap(SecondRootComponent, [provide(OverrideBinding, {useClass: OverriddenBinding})]);
|
||||
* ```
|
||||
*/
|
||||
abstract bootstrap(componentType: Type, providers?: Array<Type | Provider | any[]>):
|
||||
Promise<ComponentRef>;
|
||||
abstract bootstrap(componentType: Type,
|
||||
providers?: Array<Type | Provider | any[]>): Promise<ComponentRef>;
|
||||
|
||||
/**
|
||||
* Retrieve the application {@link Injector}.
|
||||
|
|
|
@ -51,8 +51,8 @@ export var CHANGE_DETECTION_STRATEGY_VALUES = [
|
|||
ChangeDetectionStrategy.OnPushObserve
|
||||
];
|
||||
|
||||
export function isDefaultChangeDetectionStrategy(changeDetectionStrategy: ChangeDetectionStrategy):
|
||||
boolean {
|
||||
export function isDefaultChangeDetectionStrategy(
|
||||
changeDetectionStrategy: ChangeDetectionStrategy): boolean {
|
||||
return isBlank(changeDetectionStrategy) ||
|
||||
changeDetectionStrategy === ChangeDetectionStrategy.Default;
|
||||
}
|
||||
|
|
|
@ -200,8 +200,8 @@ class CodegenCommandFactory implements CommandFactory<string> {
|
|||
}
|
||||
}
|
||||
|
||||
function visitAndReturnContext(visitor: TemplateAstVisitor, asts: TemplateAst[], context: any):
|
||||
any {
|
||||
function visitAndReturnContext(visitor: TemplateAstVisitor, asts: TemplateAst[],
|
||||
context: any): any {
|
||||
templateVisitAll(visitor, asts, context);
|
||||
return context;
|
||||
}
|
||||
|
|
|
@ -159,7 +159,8 @@ export class CompileDirectiveMetadata {
|
|||
hostListeners: hostListeners,
|
||||
hostProperties: hostProperties,
|
||||
hostAttributes: hostAttributes,
|
||||
lifecycleHooks: isPresent(lifecycleHooks) ? lifecycleHooks : [], template: template
|
||||
lifecycleHooks: isPresent(lifecycleHooks) ? lifecycleHooks : [],
|
||||
template: template
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -40,16 +40,16 @@ function parseText(text: Text, indexInParent: number, parentSourceInfo: string):
|
|||
`${parentSourceInfo} > #text(${value}):nth-child(${indexInParent})`);
|
||||
}
|
||||
|
||||
function parseAttr(element: Element, parentSourceInfo: string, attrName: string, attrValue: string):
|
||||
HtmlAttrAst {
|
||||
function parseAttr(element: Element, parentSourceInfo: string, attrName: string,
|
||||
attrValue: string): HtmlAttrAst {
|
||||
// TODO(tbosch): add source row/column source info from parse5 / package:html
|
||||
var lowerCaseAttrName = attrName.toLowerCase();
|
||||
return new HtmlAttrAst(lowerCaseAttrName, attrValue,
|
||||
`${parentSourceInfo}[${lowerCaseAttrName}=${attrValue}]`);
|
||||
}
|
||||
|
||||
function parseElement(element: Element, indexInParent: number, parentSourceInfo: string):
|
||||
HtmlElementAst {
|
||||
function parseElement(element: Element, indexInParent: number,
|
||||
parentSourceInfo: string): HtmlElementAst {
|
||||
// normalize nodename always as lower case so that following build steps
|
||||
// can rely on this
|
||||
var nodeName = DOM.nodeName(element).toLowerCase();
|
||||
|
|
|
@ -24,8 +24,8 @@ export function isStyleUrlResolvable(url: string): boolean {
|
|||
* Rewrites stylesheets by resolving and removing the @import urls that
|
||||
* are either relative or don't have a `package:` scheme
|
||||
*/
|
||||
export function extractStyleUrls(resolver: UrlResolver, baseUrl: string, cssText: string):
|
||||
StyleWithImports {
|
||||
export function extractStyleUrls(resolver: UrlResolver, baseUrl: string,
|
||||
cssText: string): StyleWithImports {
|
||||
var foundUrls = [];
|
||||
var modifiedCssText = StringWrapper.replaceAllMapped(cssText, _cssImportRe, (m) => {
|
||||
var url = isPresent(m[1]) ? m[1] : m[2];
|
||||
|
|
|
@ -50,8 +50,8 @@ export class TemplateCompiler {
|
|||
this._appId = appId;
|
||||
}
|
||||
|
||||
normalizeDirectiveMetadata(directive:
|
||||
CompileDirectiveMetadata): Promise<CompileDirectiveMetadata> {
|
||||
normalizeDirectiveMetadata(directive: CompileDirectiveMetadata):
|
||||
Promise<CompileDirectiveMetadata> {
|
||||
if (!directive.isComponent) {
|
||||
// For non components there is nothing to be normalized yet.
|
||||
return PromiseWrapper.resolve(directive);
|
||||
|
@ -70,7 +70,8 @@ export class TemplateCompiler {
|
|||
hostListeners: directive.hostListeners,
|
||||
hostProperties: directive.hostProperties,
|
||||
hostAttributes: directive.hostAttributes,
|
||||
lifecycleHooks: directive.lifecycleHooks, template: normalizedTemplate
|
||||
lifecycleHooks: directive.lifecycleHooks,
|
||||
template: normalizedTemplate
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -686,8 +686,8 @@ function _extractToken(typeOrFunc, metadata /*any[] | any*/, params: any[][]): D
|
|||
}
|
||||
}
|
||||
|
||||
function _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps):
|
||||
Dependency {
|
||||
function _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility,
|
||||
depProps): Dependency {
|
||||
return new Dependency(Key.get(token), optional, lowerBoundVisibility, upperBoundVisibility,
|
||||
depProps);
|
||||
}
|
||||
|
|
|
@ -61,8 +61,9 @@ var _clearValues: {(m: Map<any, any>)} = (function() {
|
|||
var _arrayFromMap: {(m: Map<any, any>, getValues: boolean): any[]} = (function() {
|
||||
try {
|
||||
if ((<any>(new Map()).values()).next) {
|
||||
return function createArrayFromMap(m: Map<any, any>, getValues: boolean):
|
||||
any[] { return getValues ? (<any>Array).from(m.values()) : (<any>Array).from(m.keys()); };
|
||||
return function createArrayFromMap(m: Map<any, any>, getValues: boolean): any[] {
|
||||
return getValues ? (<any>Array).from(m.values()) : (<any>Array).from(m.keys());
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
|
|
|
@ -68,8 +68,8 @@ export function isPropertyUpdated(changes: {[key: string]: any}, viewModel: any)
|
|||
}
|
||||
|
||||
// TODO: vsavkin remove it once https://github.com/angular/angular/issues/3011 is implemented
|
||||
export function selectValueAccessor(dir: NgControl, valueAccessors: ControlValueAccessor[]):
|
||||
ControlValueAccessor {
|
||||
export function selectValueAccessor(dir: NgControl,
|
||||
valueAccessors: ControlValueAccessor[]): ControlValueAccessor {
|
||||
if (isBlank(valueAccessors)) return null;
|
||||
|
||||
var defaultAccessor;
|
||||
|
|
|
@ -111,8 +111,8 @@ export abstract class AbstractControl {
|
|||
|
||||
setParent(parent: ControlGroup | ControlArray): void { this._parent = parent; }
|
||||
|
||||
updateValueAndValidity({onlySelf, emitEvent}: {onlySelf?: boolean, emitEvent?: boolean} = {}):
|
||||
void {
|
||||
updateValueAndValidity(
|
||||
{onlySelf, emitEvent}: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
|
||||
onlySelf = normalizeBool(onlySelf);
|
||||
emitEvent = isPresent(emitEvent) ? emitEvent : true;
|
||||
|
||||
|
@ -237,10 +237,11 @@ export class Control extends AbstractControl {
|
|||
* via an `onChange` event. This is the default behavior if `emitModelToViewChange` is not
|
||||
* specified.
|
||||
*/
|
||||
updateValue(value: any,
|
||||
{onlySelf, emitEvent, emitModelToViewChange}:
|
||||
{onlySelf?: boolean, emitEvent?: boolean, emitModelToViewChange?: boolean} = {}):
|
||||
void {
|
||||
updateValue(value: any, {onlySelf, emitEvent, emitModelToViewChange}: {
|
||||
onlySelf?: boolean,
|
||||
emitEvent?: boolean,
|
||||
emitModelToViewChange?: boolean
|
||||
} = {}): void {
|
||||
emitModelToViewChange = isPresent(emitModelToViewChange) ? emitModelToViewChange : true;
|
||||
this._value = value;
|
||||
if (isPresent(this._onChange) && emitModelToViewChange) this._onChange(this._value);
|
||||
|
|
|
@ -232,8 +232,8 @@ export abstract class DynamicComponentLoader {
|
|||
* <child-component>Child</child-component>
|
||||
* ```
|
||||
*/
|
||||
abstract loadNextToLocation(type: Type, location: ElementRef, providers?: ResolvedProvider[]):
|
||||
Promise<ComponentRef>;
|
||||
abstract loadNextToLocation(type: Type, location: ElementRef,
|
||||
providers?: ResolvedProvider[]): Promise<ComponentRef>;
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
|
|
|
@ -283,9 +283,9 @@ function provideDirective(directiveResolver: DirectiveResolver, type: Type): Dir
|
|||
return DirectiveProvider.createFromType(type, annotation);
|
||||
}
|
||||
|
||||
export function createDirectiveVariableBindings(variableNameAndValues: Array<string | number>,
|
||||
directiveProviders: DirectiveProvider[]):
|
||||
Map<string, number> {
|
||||
export function createDirectiveVariableBindings(
|
||||
variableNameAndValues: Array<string | number>,
|
||||
directiveProviders: DirectiveProvider[]): Map<string, number> {
|
||||
var directiveVariableBindings = new Map<string, number>();
|
||||
for (var i = 0; i < variableNameAndValues.length; i += 2) {
|
||||
var templateName = <string>variableNameAndValues[i];
|
||||
|
|
|
@ -165,8 +165,8 @@ export class EmbeddedTemplateCmd implements TemplateCmd, IBeginElementCmd,
|
|||
|
||||
export function embeddedTemplate(attrNameAndValues: string[], variableNameAndValues: string[],
|
||||
directives: Type[], isMerged: boolean, ngContentIndex: number,
|
||||
changeDetectorFactory: Function, children: TemplateCmd[]):
|
||||
EmbeddedTemplateCmd {
|
||||
changeDetectorFactory: Function,
|
||||
children: TemplateCmd[]): EmbeddedTemplateCmd {
|
||||
return new EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged,
|
||||
ngContentIndex, changeDetectorFactory, children);
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ export abstract class AppViewManager {
|
|||
* Throws an exception if the specified `hostLocation` is not a Host Element of a Component, or if
|
||||
* variable `variableName` couldn't be found in the Component View of this Component.
|
||||
*/
|
||||
abstract getNamedElementInComponentView(hostLocation: ElementRef, variableName: string):
|
||||
ElementRef;
|
||||
abstract getNamedElementInComponentView(hostLocation: ElementRef,
|
||||
variableName: string): ElementRef;
|
||||
|
||||
/**
|
||||
* Returns the component instance for the provided Host Element.
|
||||
|
|
|
@ -209,8 +209,8 @@ export abstract class Renderer {
|
|||
*
|
||||
* Returns an instance of {@link RenderViewWithFragments}, representing the Render View.
|
||||
*/
|
||||
abstract createView(protoViewRef: RenderProtoViewRef, fragmentCount: number):
|
||||
RenderViewWithFragments;
|
||||
abstract createView(protoViewRef: RenderProtoViewRef,
|
||||
fragmentCount: number): RenderViewWithFragments;
|
||||
|
||||
/**
|
||||
* Destroys a Render View specified via `viewRef`.
|
||||
|
|
|
@ -131,8 +131,8 @@ export abstract class DomRenderer extends Renderer implements NodeFactory<Node>
|
|||
abstract createRootHostView(hostProtoViewRef: RenderProtoViewRef, fragmentCount: number,
|
||||
hostElementSelector: string): RenderViewWithFragments;
|
||||
|
||||
abstract createView(protoViewRef: RenderProtoViewRef, fragmentCount: number):
|
||||
RenderViewWithFragments;
|
||||
abstract createView(protoViewRef: RenderProtoViewRef,
|
||||
fragmentCount: number): RenderViewWithFragments;
|
||||
|
||||
abstract destroyView(viewRef: RenderViewRef);
|
||||
|
||||
|
@ -207,8 +207,8 @@ export abstract class DomRenderer extends Renderer implements NodeFactory<Node>
|
|||
propertyValue);
|
||||
}
|
||||
|
||||
setElementAttribute(location: RenderElementRef, attributeName: string, attributeValue: string):
|
||||
void {
|
||||
setElementAttribute(location: RenderElementRef, attributeName: string,
|
||||
attributeValue: string): void {
|
||||
var view = resolveInternalDomView(location.renderView);
|
||||
var element = view.boundElements[location.boundElementIndex];
|
||||
var dashCasedAttributeName = camelCaseToDashCase(attributeName);
|
||||
|
|
|
@ -28,15 +28,15 @@ export class BrowserGetTestability implements GetTestability {
|
|||
static init() { setTestabilityGetter(new BrowserGetTestability()); }
|
||||
|
||||
addToWindow(registry: TestabilityRegistry): void {
|
||||
global.getAngularTestability = function(elem: Element, findInAncestors: boolean = true):
|
||||
PublicTestability {
|
||||
var testability = registry.findTestabilityInTree(elem, findInAncestors);
|
||||
global.getAngularTestability = function(elem: Element,
|
||||
findInAncestors: boolean = true): PublicTestability {
|
||||
var testability = registry.findTestabilityInTree(elem, findInAncestors);
|
||||
|
||||
if (testability == null) {
|
||||
throw new Error('Could not find testability for element.');
|
||||
}
|
||||
return new PublicTestability(testability);
|
||||
};
|
||||
if (testability == null) {
|
||||
throw new Error('Could not find testability for element.');
|
||||
}
|
||||
return new PublicTestability(testability);
|
||||
};
|
||||
global.getAllAngularTestabilities = function(): PublicTestability[] {
|
||||
var testabilities = registry.getAllTestabilities();
|
||||
return testabilities.map((testability) => { return new PublicTestability(testability); });
|
||||
|
|
|
@ -236,8 +236,8 @@ if (!(Reflect && Reflect.getMetadata)) {
|
|||
throw 'reflect-metadata shim is required when using class decorators';
|
||||
}
|
||||
|
||||
export function makeDecorator(annotationCls, chainFn: (fn: Function) => void = null):
|
||||
(...args: any[]) => (cls: any) => any {
|
||||
export function makeDecorator(
|
||||
annotationCls, chainFn: (fn: Function) => void = null): (...args: any[]) => (cls: any) => any {
|
||||
function DecoratorFactory(objOrType): (cls: any) => any {
|
||||
var annotationInstance = new (<any>annotationCls)(objOrType);
|
||||
if (this instanceof annotationCls) {
|
||||
|
|
|
@ -6,7 +6,7 @@ import {Connection, ConnectionBackend} from '../interfaces';
|
|||
import {isPresent} from 'angular2/src/core/facade/lang';
|
||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||
var Rx = require('@reactivex/rxjs/dist/cjs/Rx');
|
||||
let{Subject, ReplaySubject} = Rx;
|
||||
let {Subject, ReplaySubject} = Rx;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -42,6 +42,6 @@ export {
|
|||
*
|
||||
* {@example router/ts/can_activate/can_activate_example.ts region='canActivate' }
|
||||
*/
|
||||
export var CanActivate:
|
||||
(hook: (next: ComponentInstruction, prev: ComponentInstruction) => Promise<boolean>| boolean) =>
|
||||
ClassDecorator = makeDecorator(CanActivateAnnotation);
|
||||
export var CanActivate: (hook: (next: ComponentInstruction, prev: ComponentInstruction) =>
|
||||
Promise<boolean>| boolean) => ClassDecorator =
|
||||
makeDecorator(CanActivateAnnotation);
|
||||
|
|
|
@ -41,8 +41,8 @@ export class Route implements RouteDefinition {
|
|||
// added next two properties to work around https://github.com/Microsoft/TypeScript/issues/4107
|
||||
loader: Function;
|
||||
redirectTo: string;
|
||||
constructor({path, component, as, data}:
|
||||
{path: string, component: Type, as?: string, data?: {[key: string]: any}}) {
|
||||
constructor({path, component, as,
|
||||
data}: {path: string, component: Type, as?: string, data?: {[key: string]: any}}) {
|
||||
this.path = path;
|
||||
this.component = component;
|
||||
this.as = as;
|
||||
|
@ -115,8 +115,8 @@ export class AsyncRoute implements RouteDefinition {
|
|||
path: string;
|
||||
loader: Function;
|
||||
as: string;
|
||||
constructor({path, loader, as, data}:
|
||||
{path: string, loader: Function, as?: string, data?: {[key: string]: any}}) {
|
||||
constructor({path, loader, as,
|
||||
data}: {path: string, loader: Function, as?: string, data?: {[key: string]: any}}) {
|
||||
this.path = path;
|
||||
this.loader = loader;
|
||||
this.as = as;
|
||||
|
|
|
@ -544,8 +544,8 @@ function splitAndFlattenLinkParams(linkParams: any[]): any[] {
|
|||
}, []);
|
||||
}
|
||||
|
||||
function canActivateOne(nextInstruction: Instruction, prevInstruction: Instruction):
|
||||
Promise<boolean> {
|
||||
function canActivateOne(nextInstruction: Instruction,
|
||||
prevInstruction: Instruction): Promise<boolean> {
|
||||
var next = _resolveToTrue;
|
||||
if (isPresent(nextInstruction.child)) {
|
||||
next = canActivateOne(nextInstruction.child,
|
||||
|
|
|
@ -144,22 +144,22 @@ export function beforeEach(fn: FunctionWithParamTokens | AnyTestFn): void {
|
|||
}
|
||||
}
|
||||
|
||||
export function it(name: string, fn: FunctionWithParamTokens | AnyTestFn, timeOut: number = null):
|
||||
void {
|
||||
export function it(name: string, fn: FunctionWithParamTokens | AnyTestFn,
|
||||
timeOut: number = null): void {
|
||||
return _it(jsmIt, name, fn, timeOut);
|
||||
}
|
||||
|
||||
export function xit(name: string, fn: FunctionWithParamTokens | AnyTestFn, timeOut: number = null):
|
||||
void {
|
||||
export function xit(name: string, fn: FunctionWithParamTokens | AnyTestFn,
|
||||
timeOut: number = null): void {
|
||||
return _it(jsmXIt, name, fn, timeOut);
|
||||
}
|
||||
|
||||
export function iit(name: string, fn: FunctionWithParamTokens | AnyTestFn, timeOut: number = null):
|
||||
void {
|
||||
export function iit(name: string, fn: FunctionWithParamTokens | AnyTestFn,
|
||||
timeOut: number = null): void {
|
||||
return _it(jsmIIt, name, fn, timeOut);
|
||||
}
|
||||
|
||||
export function fit(name: string, fn: FunctionWithParamTokens | AnyTestFn, timeOut: number = null):
|
||||
void {
|
||||
export function fit(name: string, fn: FunctionWithParamTokens | AnyTestFn,
|
||||
timeOut: number = null): void {
|
||||
return _it(jsmIIt, name, fn, timeOut);
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ var _postMessage: PostMessageInterface = <any>postMessage;
|
|||
* See the bootstrap() docs for more details.
|
||||
*/
|
||||
export function bootstrapWebWorker(
|
||||
appComponentType: Type, componentInjectableProviders: Array<Type | Provider | any[]> = null):
|
||||
Promise<ComponentRef> {
|
||||
appComponentType: Type,
|
||||
componentInjectableProviders: Array<Type | Provider | any[]> = null): Promise<ComponentRef> {
|
||||
Parse5DomAdapter.makeCurrent();
|
||||
var sink = new PostMessageBusSink({
|
||||
postMessage: (message: any, transferrables?:[ArrayBuffer]) => {
|
||||
|
|
|
@ -91,8 +91,8 @@ class PrintLogger {
|
|||
logGroupEnd() {}
|
||||
}
|
||||
|
||||
function webWorkerProviders(appComponentType, bus: MessageBus, initData: {[key: string]: any}):
|
||||
Array<Type | Provider | any[]> {
|
||||
function webWorkerProviders(appComponentType, bus: MessageBus,
|
||||
initData: {[key: string]: any}): Array<Type | Provider | any[]> {
|
||||
return [
|
||||
compilerProviders(),
|
||||
Serializer,
|
||||
|
@ -114,9 +114,9 @@ function webWorkerProviders(appComponentType, bus: MessageBus, initData: {[key:
|
|||
];
|
||||
}
|
||||
|
||||
export function bootstrapWebWorkerCommon(appComponentType: Type, bus: MessageBus,
|
||||
appProviders: Array<Type | Provider | any[]> = null):
|
||||
Promise<ComponentRef> {
|
||||
export function bootstrapWebWorkerCommon(
|
||||
appComponentType: Type, bus: MessageBus,
|
||||
appProviders: Array<Type | Provider | any[]> = null): Promise<ComponentRef> {
|
||||
var bootstrapProcess: PromiseCompleter<any> = PromiseWrapper.completer();
|
||||
var appPromise = platform().asyncApplication((zone: NgZone) => {
|
||||
// TODO(rado): prepopulate template cache, so applications with only
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// no deserialization is necessary in TS.
|
||||
// This is only here to match dart interface
|
||||
export function deserializeGenericEvent(serializedEvent: {[key: string]: any}):
|
||||
{[key: string]: any} {
|
||||
export function deserializeGenericEvent(
|
||||
serializedEvent: {[key: string]: any}): {[key: string]: any} {
|
||||
return serializedEvent;
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@ function _createEventRecords(expression: string): BindingRecord[] {
|
|||
return [BindingRecord.createForEvent(ast, eventName, 0)];
|
||||
}
|
||||
|
||||
function _createHostEventRecords(expression: string, directiveRecord: DirectiveRecord):
|
||||
BindingRecord[] {
|
||||
function _createHostEventRecords(expression: string,
|
||||
directiveRecord: DirectiveRecord): BindingRecord[] {
|
||||
var parts = expression.split("=");
|
||||
var eventName = parts[0].substring(1, parts[0].length - 1);
|
||||
var exp = parts[1].substring(1, parts[1].length - 1);
|
||||
|
@ -315,48 +315,46 @@ class _DirectiveUpdating {
|
|||
* Map from test id to _DirectiveUpdating.
|
||||
* Definitions in this map define definitions which allow testing directive updating.
|
||||
*/
|
||||
static availableDefinitions:
|
||||
{[key: string]: _DirectiveUpdating} = {
|
||||
'directNoDispatcher': new _DirectiveUpdating(
|
||||
[_DirectiveUpdating.updateA('42', _DirectiveUpdating.basicRecords[0])],
|
||||
static availableDefinitions: {[key: string]: _DirectiveUpdating} = {
|
||||
'directNoDispatcher': new _DirectiveUpdating(
|
||||
[_DirectiveUpdating.updateA('42', _DirectiveUpdating.basicRecords[0])],
|
||||
[_DirectiveUpdating.basicRecords[0]]),
|
||||
'groupChanges':
|
||||
new _DirectiveUpdating(
|
||||
[
|
||||
_DirectiveUpdating.updateA('1', _DirectiveUpdating.basicRecords[0]),
|
||||
_DirectiveUpdating.updateB('2', _DirectiveUpdating.basicRecords[0]),
|
||||
BindingRecord.createDirectiveOnChanges(_DirectiveUpdating.basicRecords[0]),
|
||||
_DirectiveUpdating.updateA('3', _DirectiveUpdating.basicRecords[1]),
|
||||
BindingRecord.createDirectiveOnChanges(_DirectiveUpdating.basicRecords[1])
|
||||
],
|
||||
[_DirectiveUpdating.basicRecords[0], _DirectiveUpdating.basicRecords[1]]),
|
||||
'directiveDoCheck': new _DirectiveUpdating(
|
||||
[BindingRecord.createDirectiveDoCheck(_DirectiveUpdating.basicRecords[0])],
|
||||
[_DirectiveUpdating.basicRecords[0]]),
|
||||
'directiveOnInit': new _DirectiveUpdating(
|
||||
[BindingRecord.createDirectiveOnInit(_DirectiveUpdating.basicRecords[0])],
|
||||
[_DirectiveUpdating.basicRecords[0]]),
|
||||
'emptyWithDirectiveRecords': new _DirectiveUpdating(
|
||||
[], [_DirectiveUpdating.basicRecords[0], _DirectiveUpdating.basicRecords[1]]),
|
||||
'noCallbacks': new _DirectiveUpdating(
|
||||
[_DirectiveUpdating.updateA('1', _DirectiveUpdating.recordNoCallbacks)],
|
||||
[_DirectiveUpdating.recordNoCallbacks]),
|
||||
'readingDirectives':
|
||||
new _DirectiveUpdating(
|
||||
[
|
||||
BindingRecord.createForHostProperty(
|
||||
new DirectiveIndex(0, 0), _getParser().parseBinding('a', 'location'), PROP_NAME)
|
||||
],
|
||||
[_DirectiveUpdating.basicRecords[0]]),
|
||||
'groupChanges':
|
||||
new _DirectiveUpdating(
|
||||
[
|
||||
_DirectiveUpdating.updateA('1', _DirectiveUpdating.basicRecords[0]),
|
||||
_DirectiveUpdating.updateB('2', _DirectiveUpdating.basicRecords[0]),
|
||||
BindingRecord.createDirectiveOnChanges(_DirectiveUpdating.basicRecords[0]),
|
||||
_DirectiveUpdating.updateA('3', _DirectiveUpdating.basicRecords[1]),
|
||||
BindingRecord.createDirectiveOnChanges(_DirectiveUpdating.basicRecords[1])
|
||||
],
|
||||
[_DirectiveUpdating.basicRecords[0], _DirectiveUpdating.basicRecords[1]]),
|
||||
'directiveDoCheck': new _DirectiveUpdating(
|
||||
[BindingRecord.createDirectiveDoCheck(_DirectiveUpdating.basicRecords[0])],
|
||||
[_DirectiveUpdating.basicRecords[0]]),
|
||||
'directiveOnInit': new _DirectiveUpdating(
|
||||
[BindingRecord.createDirectiveOnInit(_DirectiveUpdating.basicRecords[0])],
|
||||
[_DirectiveUpdating.basicRecords[0]]),
|
||||
'emptyWithDirectiveRecords': new _DirectiveUpdating(
|
||||
[], [_DirectiveUpdating.basicRecords[0], _DirectiveUpdating.basicRecords[1]]),
|
||||
'noCallbacks': new _DirectiveUpdating(
|
||||
[_DirectiveUpdating.updateA('1', _DirectiveUpdating.recordNoCallbacks)],
|
||||
[_DirectiveUpdating.recordNoCallbacks]),
|
||||
'readingDirectives':
|
||||
new _DirectiveUpdating(
|
||||
[
|
||||
BindingRecord.createForHostProperty(new DirectiveIndex(0, 0),
|
||||
_getParser().parseBinding('a', 'location'),
|
||||
PROP_NAME)
|
||||
],
|
||||
[_DirectiveUpdating.basicRecords[0]]),
|
||||
'interpolation':
|
||||
new _DirectiveUpdating(
|
||||
[
|
||||
BindingRecord.createForElementProperty(
|
||||
_getParser().parseInterpolation('B{{a}}A', 'location'), 0, PROP_NAME)
|
||||
],
|
||||
[])
|
||||
};
|
||||
'interpolation':
|
||||
new _DirectiveUpdating(
|
||||
[
|
||||
BindingRecord.createForElementProperty(
|
||||
_getParser().parseInterpolation('B{{a}}A', 'location'), 0, PROP_NAME)
|
||||
],
|
||||
[])
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,15 +13,15 @@ import {isBlank} from 'angular2/src/core/facade/lang';
|
|||
import {RecordType, ProtoRecord} from 'angular2/src/core/change_detection/proto_record';
|
||||
|
||||
export function main() {
|
||||
function r({lastInBinding, mode, name, directiveIndex, argumentToPureFunction, referencedBySelf}:
|
||||
{
|
||||
lastInBinding?: any,
|
||||
mode?: any,
|
||||
name?: any,
|
||||
directiveIndex?: any,
|
||||
argumentToPureFunction?: boolean,
|
||||
referencedBySelf?: boolean
|
||||
} = {}) {
|
||||
function r(
|
||||
{lastInBinding, mode, name, directiveIndex, argumentToPureFunction, referencedBySelf}: {
|
||||
lastInBinding?: any,
|
||||
mode?: any,
|
||||
name?: any,
|
||||
directiveIndex?: any,
|
||||
argumentToPureFunction?: boolean,
|
||||
referencedBySelf?: boolean
|
||||
} = {}) {
|
||||
if (isBlank(lastInBinding)) lastInBinding = false;
|
||||
if (isBlank(mode)) mode = RecordType.PropertyRead;
|
||||
if (isBlank(name)) name = "name";
|
||||
|
|
|
@ -108,9 +108,9 @@ export function main() {
|
|||
});
|
||||
|
||||
describe('compileComponentCodeGen', () => {
|
||||
function detectChanges(compiler: ChangeDetectionCompiler, template: string,
|
||||
directives: CompileDirectiveMetadata[] = CONST_EXPR([])):
|
||||
Promise<string[]> {
|
||||
function detectChanges(
|
||||
compiler: ChangeDetectionCompiler, template: string,
|
||||
directives: CompileDirectiveMetadata[] = CONST_EXPR([])): Promise<string[]> {
|
||||
var type =
|
||||
new CompileTypeMetadata({name: stringify(SomeComponent), moduleUrl: THIS_MODULE_URL});
|
||||
var parsedTemplate = parser.parse(template, directives, 'TestComp');
|
||||
|
@ -133,8 +133,8 @@ export function main() {
|
|||
});
|
||||
}
|
||||
|
||||
function createTestableModule(source: SourceExpressions, changeDetectorIndex: number):
|
||||
SourceModule {
|
||||
function createTestableModule(source: SourceExpressions,
|
||||
changeDetectorIndex: number): SourceModule {
|
||||
var resultExpression =
|
||||
`${THIS_MODULE_REF}testChangeDetector(([${source.expressions.join(',')}])[${changeDetectorIndex}])`;
|
||||
var testableSource = `${source.declarations.join('\n')}
|
||||
|
|
|
@ -120,8 +120,8 @@ export function main() {
|
|||
});
|
||||
}
|
||||
|
||||
function createDirective(type: CompileTypeMetadata, selector: string, exportAs: string = null):
|
||||
CompileDirectiveMetadata {
|
||||
function createDirective(type: CompileTypeMetadata, selector: string,
|
||||
exportAs: string = null): CompileDirectiveMetadata {
|
||||
return CompileDirectiveMetadata.create(
|
||||
{selector: selector, exportAs: exportAs, isComponent: false, type: type});
|
||||
}
|
||||
|
|
|
@ -42,7 +42,8 @@ export function main() {
|
|||
selector: 'someSelector',
|
||||
isComponent: true,
|
||||
dynamicLoadable: true,
|
||||
type: fullTypeMeta, template: fullTemplateMeta,
|
||||
type: fullTypeMeta,
|
||||
template: fullTemplateMeta,
|
||||
changeDetection: ChangeDetectionStrategy.Default,
|
||||
inputs: ['someProp'],
|
||||
outputs: ['someEvent'],
|
||||
|
|
|
@ -74,8 +74,8 @@ export function main() {
|
|||
`a {color: green}@import ${IMPORT_REL_STYLESHEET_URL};`;
|
||||
});
|
||||
|
||||
function compile(styles: string[], styleAbsUrls: string[], encapsulation: ViewEncapsulation):
|
||||
Promise<string[]> {
|
||||
function compile(styles: string[], styleAbsUrls: string[],
|
||||
encapsulation: ViewEncapsulation): Promise<string[]> {
|
||||
// Note: Can't use MockXHR as the xhr is called recursively,
|
||||
// so we can't trigger flush.
|
||||
xhr.spy('get').andCallFake((url) => {
|
||||
|
@ -203,8 +203,8 @@ export function main() {
|
|||
});
|
||||
|
||||
describe('compileComponentCodeGen', () => {
|
||||
function compile(styles: string[], styleAbsUrls: string[], encapsulation: ViewEncapsulation):
|
||||
Promise<string[]> {
|
||||
function compile(styles: string[], styleAbsUrls: string[],
|
||||
encapsulation: ViewEncapsulation): Promise<string[]> {
|
||||
var sourceExpression = compiler.compileComponentCodeGen(
|
||||
`'${appId}'`, `${templateId}`,
|
||||
new CompileTemplateMetadata(
|
||||
|
|
|
@ -190,8 +190,8 @@ export function main() {
|
|||
});
|
||||
|
||||
describe('compileTemplatesCodeGen', () => {
|
||||
function normalizeComponent(component: Type):
|
||||
Promise<NormalizedComponentWithViewDirectives> {
|
||||
function normalizeComponent(
|
||||
component: Type): Promise<NormalizedComponentWithViewDirectives> {
|
||||
var compAndViewDirMetas = [runtimeMetadataResolver.getMetadata(component)].concat(
|
||||
runtimeMetadataResolver.getViewDirectivesMetadata(component));
|
||||
return PromiseWrapper.all(compAndViewDirMetas.map(
|
||||
|
@ -316,8 +316,8 @@ class CompWithEmbeddedTemplate {
|
|||
class NonComponent {
|
||||
}
|
||||
|
||||
function testableTemplateModule(sourceModule: SourceModule, normComp: CompileDirectiveMetadata):
|
||||
SourceModule {
|
||||
function testableTemplateModule(sourceModule: SourceModule,
|
||||
normComp: CompileDirectiveMetadata): SourceModule {
|
||||
var resultExpression =
|
||||
`${THIS_MODULE_REF}humanizeTemplate(Host${normComp.type.name}Template.getTemplate())`;
|
||||
var testableSource = `${sourceModule.sourceWithModuleRefs}
|
||||
|
@ -332,9 +332,9 @@ function testableStylesModule(sourceModule: SourceModule): SourceModule {
|
|||
}
|
||||
|
||||
// Attention: read by eval!
|
||||
export function humanizeTemplate(template: CompiledTemplate,
|
||||
humanizedTemplates: Map<number, {[key: string]: any}> = null):
|
||||
{[key: string]: any} {
|
||||
export function humanizeTemplate(
|
||||
template: CompiledTemplate,
|
||||
humanizedTemplates: Map<number, {[key: string]: any}> = null): {[key: string]: any} {
|
||||
if (isBlank(humanizedTemplates)) {
|
||||
humanizedTemplates = new Map<number, {[key: string]: any}>();
|
||||
}
|
||||
|
|
|
@ -553,7 +553,8 @@ There is no directive with "exportAs" set to "dirA" at TestComp > div:nth-child(
|
|||
selector: '[a]',
|
||||
isComponent: true,
|
||||
type: new CompileTypeMetadata({name: 'DirA'}),
|
||||
exportAs: 'dirA', template: new CompileTemplateMetadata({ngContentSelectors: []})
|
||||
exportAs: 'dirA',
|
||||
template: new CompileTemplateMetadata({ngContentSelectors: []})
|
||||
});
|
||||
expect(humanizeTemplateAsts(parse('<div a #a></div>', [dirA])))
|
||||
.toEqual([
|
||||
|
@ -686,8 +687,8 @@ There is no directive with "exportAs" set to "dirA" at TestComp > div:nth-child(
|
|||
});
|
||||
|
||||
describe('content projection', () => {
|
||||
function createComp(selector: string, ngContentSelectors: string[]):
|
||||
CompileDirectiveMetadata {
|
||||
function createComp(selector: string,
|
||||
ngContentSelectors: string[]): CompileDirectiveMetadata {
|
||||
return CompileDirectiveMetadata.create({
|
||||
selector: selector,
|
||||
isComponent: true,
|
||||
|
|
|
@ -52,7 +52,7 @@ class MessageDir {
|
|||
<span class="childnested" message="nestedchild">Child</span>
|
||||
</div>
|
||||
<span class="child" [inner-html]="childBinding"></span>`,
|
||||
directives: [MessageDir]
|
||||
directives: [MessageDir],
|
||||
})
|
||||
@Injectable()
|
||||
class ChildComp {
|
||||
|
@ -64,7 +64,7 @@ class ChildComp {
|
|||
@Component({selector: 'cond-content-comp', viewProviders: [Logger]})
|
||||
@View({
|
||||
template: `<div class="child" message="child" *ng-if="false"><ng-content></ng-content></div>`,
|
||||
directives: [NgIf, MessageDir]
|
||||
directives: [NgIf, MessageDir],
|
||||
})
|
||||
@Injectable()
|
||||
class ConditionalContentComp {
|
||||
|
@ -78,7 +78,7 @@ class ConditionalContentComp {
|
|||
<span class="parent" [inner-html]="parentBinding"></span>
|
||||
<child-comp class="child-comp-class"></child-comp>
|
||||
<cond-content-comp class="cond-content-comp-class"></cond-content-comp>`,
|
||||
directives: [ChildComp, MessageDir, ConditionalContentComp]
|
||||
directives: [ChildComp, MessageDir, ConditionalContentComp],
|
||||
})
|
||||
@Injectable()
|
||||
class ParentComp {
|
||||
|
@ -98,7 +98,7 @@ class CustomEmitter {
|
|||
@View({
|
||||
template: `<button (click)="handleClick()"></button>
|
||||
<custom-emitter (myevent)="handleCustom()"></custom-emitter>`,
|
||||
directives: [CustomEmitter]
|
||||
directives: [CustomEmitter],
|
||||
})
|
||||
@Injectable()
|
||||
class EventsComp {
|
||||
|
@ -121,7 +121,7 @@ class EventsComp {
|
|||
<ul message="list">
|
||||
<li *ng-for="#item of stuff" [inner-html]="item"></li>
|
||||
</ul>`,
|
||||
directives: [NgFor, MessageDir]
|
||||
directives: [NgFor, MessageDir],
|
||||
})
|
||||
@Injectable()
|
||||
class UsingFor {
|
||||
|
|
|
@ -78,27 +78,29 @@ export function main() {
|
|||
}));
|
||||
|
||||
it("should emit ng-submit event on submit",
|
||||
inject(
|
||||
[TestComponentBuilder], fakeAsync((tcb: TestComponentBuilder) => {
|
||||
var t =
|
||||
`<div><form [ng-form-model]="form" (ng-submit)="name='updated'"></form><span>{{name}}</span></div>`;
|
||||
inject([TestComponentBuilder], fakeAsync((tcb: TestComponentBuilder) => {
|
||||
var t = `<div>
|
||||
<form [ng-form-model]="form" (ng-submit)="name='updated'"></form>
|
||||
<span>{{name}}</span>
|
||||
</div>`;
|
||||
|
||||
var rootTC: RootTestComponent;
|
||||
var rootTC: RootTestComponent;
|
||||
|
||||
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => { rootTC = root; });
|
||||
tick();
|
||||
tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then(
|
||||
(root) => { rootTC = root; });
|
||||
tick();
|
||||
|
||||
rootTC.debugElement.componentInstance.form = new ControlGroup({});
|
||||
rootTC.debugElement.componentInstance.name = 'old';
|
||||
rootTC.debugElement.componentInstance.form = new ControlGroup({});
|
||||
rootTC.debugElement.componentInstance.name = 'old';
|
||||
|
||||
tick();
|
||||
tick();
|
||||
|
||||
var form = rootTC.debugElement.query(By.css("form"));
|
||||
dispatchEvent(form.nativeElement, "submit");
|
||||
var form = rootTC.debugElement.query(By.css("form"));
|
||||
dispatchEvent(form.nativeElement, "submit");
|
||||
|
||||
tick();
|
||||
expect(rootTC.debugElement.componentInstance.name).toEqual('updated');
|
||||
})));
|
||||
tick();
|
||||
expect(rootTC.debugElement.componentInstance.name).toEqual('updated');
|
||||
})));
|
||||
|
||||
it("should work with single controls",
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
|
|
|
@ -43,7 +43,7 @@ export function main() {
|
|||
@Component({selector: 'app', viewProviders: [forwardRef(() => Frame)]})
|
||||
@View({
|
||||
template: `<door><lock></lock></door>`,
|
||||
directives: [forwardRef(() => Door), forwardRef(() => Lock)]
|
||||
directives: [forwardRef(() => Door), forwardRef(() => Lock)],
|
||||
})
|
||||
class App {
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class App {
|
|||
@Component({selector: 'Lock'})
|
||||
@View({
|
||||
directives: [NgFor],
|
||||
template: `{{frame.name}}(<span *ng-for="var lock of locks">{{lock.name}}</span>)`
|
||||
template: `{{frame.name}}(<span *ng-for="var lock of locks">{{lock.name}}</span>)`,
|
||||
})
|
||||
class Door {
|
||||
locks: QueryList<Lock>;
|
||||
|
|
|
@ -2321,7 +2321,8 @@ class DirectiveThrowingAnError {
|
|||
|
||||
@Component({
|
||||
selector: 'component-with-template',
|
||||
directives: [NgFor], template: `No View Decorator: <div *ng-for="#item of items">{{item}}</div>`
|
||||
directives: [NgFor],
|
||||
template: `No View Decorator: <div *ng-for="#item of items">{{item}}</div>`
|
||||
})
|
||||
class ComponentWithTemplate {
|
||||
items = [1, 2, 3];
|
||||
|
|
|
@ -470,32 +470,32 @@ export function main() {
|
|||
|
||||
it('should allow to switch the order of nested components via ng-content',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
tcb.overrideView(
|
||||
MainComp,
|
||||
new ViewMetadata(
|
||||
{template: `<cmp-a><cmp-b></cmp-b></cmp-a>`, directives: [CmpA, CmpB]}))
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: `<cmp-a><cmp-b></cmp-b></cmp-a>`,
|
||||
directives: [CmpA, CmpB],
|
||||
}))
|
||||
.createAsync(MainComp)
|
||||
.then((main) => {
|
||||
main.detectChanges();
|
||||
expect(DOM.getInnerHTML(main.debugElement.nativeElement))
|
||||
.toEqual(
|
||||
'<cmp-a><cmp-b><cmp-d><d>cmp-d</d></cmp-d></cmp-b><cmp-c><c>cmp-c</c></cmp-c></cmp-a>');
|
||||
.toEqual('<cmp-a><cmp-b><cmp-d><d>cmp-d</d></cmp-d></cmp-b>' +
|
||||
'<cmp-c><c>cmp-c</c></cmp-c></cmp-a>');
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
|
||||
it('should create nested components in the right order',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
tcb.overrideView(
|
||||
MainComp,
|
||||
new ViewMetadata(
|
||||
{template: `<cmp-a1></cmp-a1><cmp-a2></cmp-a2>`, directives: [CmpA1, CmpA2]}))
|
||||
tcb.overrideView(MainComp, new ViewMetadata({
|
||||
template: `<cmp-a1></cmp-a1><cmp-a2></cmp-a2>`,
|
||||
directives: [CmpA1, CmpA2],
|
||||
}))
|
||||
.createAsync(MainComp)
|
||||
.then((main) => {
|
||||
main.detectChanges();
|
||||
expect(DOM.getInnerHTML(main.debugElement.nativeElement))
|
||||
.toEqual(
|
||||
'<cmp-a1>a1<cmp-b11>b11</cmp-b11><cmp-b12>b12</cmp-b12></cmp-a1><cmp-a2>a2<cmp-b21>b21</cmp-b21><cmp-b22>b22</cmp-b22></cmp-a2>');
|
||||
.toEqual('<cmp-a1>a1<cmp-b11>b11</cmp-b11><cmp-b12>b12</cmp-b12></cmp-a1>' +
|
||||
'<cmp-a2>a2<cmp-b21>b21</cmp-b21><cmp-b22>b22</cmp-b22></cmp-a2>');
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
|
|
|
@ -31,7 +31,7 @@ import {
|
|||
} from 'angular2/http';
|
||||
|
||||
var Rx = require('@reactivex/rxjs/dist/cjs/Rx');
|
||||
let{Observable, Subject} = Rx;
|
||||
let {Observable, Subject} = Rx;
|
||||
|
||||
class SpyObserver extends SpyObject {
|
||||
onNext: Function;
|
||||
|
|
|
@ -288,16 +288,24 @@ function parentLoader() {
|
|||
}
|
||||
|
||||
@Component({selector: 'parent-cmp'})
|
||||
@View({template: "inner { <router-outlet></router-outlet> }", directives: [RouterOutlet]})
|
||||
@RouteConfig(
|
||||
[new Route({path: '/b', component: HelloCmp}), new Route({path: '/', component: HelloCmp})])
|
||||
@View({
|
||||
template: "inner { <router-outlet></router-outlet> }",
|
||||
directives: [RouterOutlet],
|
||||
})
|
||||
@RouteConfig([
|
||||
new Route({path: '/b', component: HelloCmp}),
|
||||
new Route({path: '/', component: HelloCmp}),
|
||||
])
|
||||
class ParentCmp {
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
|
||||
@Component({selector: 'team-cmp'})
|
||||
@View({template: "team {{id}} { <router-outlet></router-outlet> }", directives: [RouterOutlet]})
|
||||
@View({
|
||||
template: "team {{id}} { <router-outlet></router-outlet> }",
|
||||
directives: [RouterOutlet],
|
||||
})
|
||||
@RouteConfig([new Route({path: '/user/:name', component: UserCmp})])
|
||||
class TeamCmp {
|
||||
id: string;
|
||||
|
@ -320,13 +328,13 @@ class ModalCmp {
|
|||
|
||||
@Component({selector: 'aux-cmp'})
|
||||
@View({
|
||||
template:
|
||||
`main {<router-outlet></router-outlet>} | aux {<router-outlet name="modal"></router-outlet>}`,
|
||||
directives: [RouterOutlet]
|
||||
template: 'main {<router-outlet></router-outlet>} | ' +
|
||||
'aux {<router-outlet name="modal"></router-outlet>}',
|
||||
directives: [RouterOutlet],
|
||||
})
|
||||
@RouteConfig([
|
||||
new Route({path: '/hello', component: HelloCmp}),
|
||||
new AuxRoute({path: '/modal', component: ModalCmp})
|
||||
new AuxRoute({path: '/modal', component: ModalCmp}),
|
||||
])
|
||||
class AuxCmp {
|
||||
}
|
||||
|
|
|
@ -235,8 +235,7 @@ class StaticTreeComponent0 extends StaticTreeComponentBase {
|
|||
@Component({selector: 'tree', inputs: ['data']})
|
||||
@View({
|
||||
directives: [StaticTreeComponent0],
|
||||
template:
|
||||
`<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
})
|
||||
class StaticTreeComponent1 extends StaticTreeComponentBase {
|
||||
}
|
||||
|
@ -244,8 +243,7 @@ class StaticTreeComponent1 extends StaticTreeComponentBase {
|
|||
@Component({selector: 'tree', inputs: ['data']})
|
||||
@View({
|
||||
directives: [StaticTreeComponent1],
|
||||
template:
|
||||
`<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
})
|
||||
class StaticTreeComponent2 extends StaticTreeComponentBase {
|
||||
data: TreeNode;
|
||||
|
@ -254,8 +252,7 @@ class StaticTreeComponent2 extends StaticTreeComponentBase {
|
|||
@Component({selector: 'tree', inputs: ['data']})
|
||||
@View({
|
||||
directives: [StaticTreeComponent2],
|
||||
template:
|
||||
`<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
})
|
||||
class StaticTreeComponent3 extends StaticTreeComponentBase {
|
||||
}
|
||||
|
@ -263,8 +260,7 @@ class StaticTreeComponent3 extends StaticTreeComponentBase {
|
|||
@Component({selector: 'tree', inputs: ['data']})
|
||||
@View({
|
||||
directives: [StaticTreeComponent3],
|
||||
template:
|
||||
`<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
})
|
||||
class StaticTreeComponent4 extends StaticTreeComponentBase {
|
||||
}
|
||||
|
@ -272,8 +268,7 @@ class StaticTreeComponent4 extends StaticTreeComponentBase {
|
|||
@Component({selector: 'tree', inputs: ['data']})
|
||||
@View({
|
||||
directives: [StaticTreeComponent4],
|
||||
template:
|
||||
`<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
})
|
||||
class StaticTreeComponent5 extends StaticTreeComponentBase {
|
||||
}
|
||||
|
@ -281,8 +276,7 @@ class StaticTreeComponent5 extends StaticTreeComponentBase {
|
|||
@Component({selector: 'tree', inputs: ['data']})
|
||||
@View({
|
||||
directives: [StaticTreeComponent5],
|
||||
template:
|
||||
`<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
})
|
||||
class StaticTreeComponent6 extends StaticTreeComponentBase {
|
||||
}
|
||||
|
@ -290,8 +284,7 @@ class StaticTreeComponent6 extends StaticTreeComponentBase {
|
|||
@Component({selector: 'tree', inputs: ['data']})
|
||||
@View({
|
||||
directives: [StaticTreeComponent6],
|
||||
template:
|
||||
`<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
})
|
||||
class StaticTreeComponent7 extends StaticTreeComponentBase {
|
||||
}
|
||||
|
@ -299,8 +292,7 @@ class StaticTreeComponent7 extends StaticTreeComponentBase {
|
|||
@Component({selector: 'tree', inputs: ['data']})
|
||||
@View({
|
||||
directives: [StaticTreeComponent7],
|
||||
template:
|
||||
`<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
})
|
||||
class StaticTreeComponent8 extends StaticTreeComponentBase {
|
||||
}
|
||||
|
@ -308,8 +300,7 @@ class StaticTreeComponent8 extends StaticTreeComponentBase {
|
|||
@Component({selector: 'tree', inputs: ['data']})
|
||||
@View({
|
||||
directives: [StaticTreeComponent8],
|
||||
template:
|
||||
`<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
template: `<span> {{data.value}} <tree [data]='data.right'></tree><tree [data]='data.left'></tree></span>`
|
||||
})
|
||||
class StaticTreeComponent9 extends StaticTreeComponentBase {
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@ function addTreeDirective(module, level: number) {
|
|||
if (level <= 0) {
|
||||
template = `<span> {{data.value}}</span>`
|
||||
} else {
|
||||
template =
|
||||
`<span> {{data.value}} <tree${level-1} data='data.right'></tree${level-1}><tree${level-1} data='data.left'></tree${level-1}></span>`;
|
||||
template = `<span> {{data.value}} <tree${level-1} data='data.right'></tree${level-1}><tree${level-1} data='data.left'></tree${level-1}></span>`;
|
||||
}
|
||||
module.directive(`tree${level}`, function() { return {scope: {data: '='}, template: template}; });
|
||||
}
|
||||
|
|
|
@ -220,8 +220,8 @@ export class ChromeDriverExtension extends WebDriverExtension {
|
|||
}
|
||||
}
|
||||
|
||||
function normalizeEvent(chromeEvent: {[key: string]: any}, data: {[key: string]: any}):
|
||||
{[key: string]: any} {
|
||||
function normalizeEvent(chromeEvent: {[key: string]: any},
|
||||
data: {[key: string]: any}): {[key: string]: any} {
|
||||
var ph = chromeEvent['ph'];
|
||||
if (StringWrapper.equals(ph, 'S')) {
|
||||
ph = 'b';
|
||||
|
|
|
@ -372,7 +372,8 @@ export function main() {
|
|||
var ng1 = function() {
|
||||
return {
|
||||
scope: {title: '@'},
|
||||
bindToController: true, template: '{{ctl.title}}',
|
||||
bindToController: true,
|
||||
template: '{{ctl.title}}',
|
||||
controllerAs: 'ctl',
|
||||
controller: Class({constructor: function() {}})
|
||||
};
|
||||
|
@ -400,7 +401,8 @@ export function main() {
|
|||
var ng1 = function($rootScope) {
|
||||
return {
|
||||
scope: {title: '@'},
|
||||
bindToController: true, template: '{{ctl.status}}',
|
||||
bindToController: true,
|
||||
template: '{{ctl.status}}',
|
||||
require: 'ng1',
|
||||
controller: Class({constructor: function() { this.status = 'WORKS'; }}),
|
||||
link: function(scope, element, attrs, linkController) {
|
||||
|
@ -437,7 +439,8 @@ export function main() {
|
|||
var ng1 = function() {
|
||||
return {
|
||||
scope: {title: '@'},
|
||||
bindToController: true, template: '{{parent.parent}}:{{ng1.status}}',
|
||||
bindToController: true,
|
||||
template: '{{parent.parent}}:{{ng1.status}}',
|
||||
require: ['ng1', '^parent', '?^^notFound'],
|
||||
controller: Class({constructor: function() { this.status = 'WORKS'; }}),
|
||||
link: function(scope, element, attrs, linkControllers) {
|
||||
|
@ -510,7 +513,8 @@ export function main() {
|
|||
module.directive('ng1', function() {
|
||||
return {
|
||||
scope: {title: '='},
|
||||
transclude: true, template: 'ng1[Hello {{title}}!](<span ng-transclude></span>)'
|
||||
transclude: true,
|
||||
template: 'ng1[Hello {{title}}!](<span ng-transclude></span>)'
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ export class LodashRenderer implements DiffingBroccoliPlugin {
|
|||
private options: LodashRendererOptions = kDefaultOptions) {}
|
||||
|
||||
rebuild(treeDiff: DiffResult) {
|
||||
let{encoding = 'utf-8', context = {}} = this.options;
|
||||
let {encoding = 'utf-8', context = {}} = this.options;
|
||||
let processFile = (relativePath) => {
|
||||
let sourceFilePath = path.join(this.inputPath, relativePath);
|
||||
let destFilePath = path.join(this.cachePath, relativePath);
|
||||
|
|
|
@ -124,7 +124,7 @@ class DiffingTSCompiler implements DiffingBroccoliPlugin {
|
|||
allDiagnostics.forEach(diagnostic => {
|
||||
let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
||||
if (diagnostic.file) {
|
||||
let{line, character} = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
let {line, character} = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
errors.push(` ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
||||
} else {
|
||||
errors.push(` Error: ${message}`);
|
||||
|
|
Loading…
Reference in New Issue