Skip to content

Commit

Permalink
fix(typings): update test.typings for abstract superclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle authored and vsavkin committed Oct 8, 2015
1 parent 6075509 commit 5458036
Show file tree
Hide file tree
Showing 34 changed files with 122 additions and 71 deletions.
2 changes: 1 addition & 1 deletion docs/typescript-definition-package/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage,
references: ['./angular2.d.ts', '../jasmine/jasmine.d.ts'],
remapTypes: { Type: 'ng.Type', Binding: 'ng.Binding', ViewMetadata: 'ng.ViewMetadata', Injector: 'ng.Injector',
Predicate: 'ng.Predicate', ElementRef: 'ng.ElementRef', DebugElement: 'ng.DebugElement',
InjectableReference: 'ng.InjectableReference' },
InjectableReference: 'ng.InjectableReference', ComponentRef: 'ng.ComponentRef' },
modules: {'angular2/test_lib': {namespace: 'ngTestLib', id: 'angular2/test_lib'}}
}
];
Expand Down
4 changes: 4 additions & 0 deletions docs/typescript-definition-package/processors/code_gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ DtsSerializer.prototype = {
},

interfaceOrClass: function(buffer, ast, isInterface) {
if (ast.abstract) {
buffer.push('abstract ');
}

buffer.push(isInterface ? 'interface ' : 'class ');
buffer.push(ast.name);
buffer.push(ast.typeParams);
Expand Down
7 changes: 7 additions & 0 deletions docs/typescript-package/processors/readTypeScriptModules.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
if (exportSymbol.flags & ts.SymbolFlags.TypeAlias) {
exportDoc.typeDefinition = typeDefinition;
}
if (isAbstract(exportSymbol)) {
exportDoc.abstract = true;
}

// Compute the original module name from the relative file path
exportDoc.originalModule = exportDoc.fileInfo.relativePath
Expand Down Expand Up @@ -345,6 +348,10 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
}
}

function isAbstract(symbol) {
var declaration = symbol.valueDeclaration || symbol.declarations[0];
return declaration.flags & ts.NodeFlags.Abstract;
}

function expandSourceFiles(sourceFiles, basePath) {
var filePaths = [];
Expand Down
12 changes: 8 additions & 4 deletions modules/angular2/src/core/application_ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ import {ViewResolver} from './linker/view_resolver';
import {DirectiveResolver} from './linker/directive_resolver';
import {PipeResolver} from './linker/pipe_resolver';
import {Compiler} from 'angular2/src/core/linker/compiler';
import {DynamicComponentLoader_} from "./linker/dynamic_component_loader";
import {AppViewManager_} from "./linker/view_manager";
import {Compiler_} from "./linker/compiler";

/**
* Constructs the set of bindings meant for use at the platform level.
Expand Down Expand Up @@ -71,7 +74,7 @@ function _componentBindings(appComponentType: Type): Array<Type | Binding | any[
return componentRef;
});
},
[DynamicComponentLoader, Injector]),
[bind(DynamicComponentLoader).toClass(DynamicComponentLoader_), Injector]),

bind(appComponentType)
.toFactory((p: Promise<any>) => p.then(ref => ref.instance), [APP_COMPONENT_REF_PROMISE]),
Expand All @@ -84,11 +87,12 @@ function _componentBindings(appComponentType: Type): Array<Type | Binding | any[
*/
export function applicationCommonBindings(): Array<Type | Binding | any[]> {
return [
Compiler,
bind(Compiler)
.toClass(Compiler_),
APP_ID_RANDOM_BINDING,
AppViewPool,
bind(APP_VIEW_POOL_CAPACITY).toValue(10000),
AppViewManager,
bind(AppViewManager).toClass(AppViewManager_),
AppViewManagerUtils,
AppViewListener,
ProtoViewFactory,
Expand All @@ -98,7 +102,7 @@ export function applicationCommonBindings(): Array<Type | Binding | any[]> {
bind(KeyValueDiffers).toValue(defaultKeyValueDiffers),
DirectiveResolver,
PipeResolver,
DynamicComponentLoader,
bind(DynamicComponentLoader).toClass(DynamicComponentLoader_),
bind(LifeCycle).toFactory((exceptionHandler) => new LifeCycle_(null, assertionsEnabled()),
[ExceptionHandler]),
];
Expand Down
3 changes: 2 additions & 1 deletion modules/angular2/src/core/compiler/compiler.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {RuntimeCompiler_} from "./runtime_compiler";
export {TemplateCompiler} from './template_compiler';
export {
CompileDirectiveMetadata,
Expand Down Expand Up @@ -43,7 +44,7 @@ export function compilerBindings(): Array<Type | Binding | any[]> {
.toValue(
new ChangeDetectorGenConfig(assertionsEnabled(), assertionsEnabled(), false, true)),
TemplateCompiler,
RuntimeCompiler,
bind(RuntimeCompiler).toClass(RuntimeCompiler_),
bind(Compiler).toAlias(RuntimeCompiler),
DomElementSchemaRegistry,
bind(ElementSchemaRegistry).toAlias(DomElementSchemaRegistry),
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/core/debug.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './debug/debug_element';
export {DebugElement, asNativeElements, By, Scope, inspectElement} from './debug/debug_element';
export {inspectNativeElement, ELEMENT_PROBE_BINDINGS} from './debug/debug_element_view_listener';
2 changes: 1 addition & 1 deletion modules/angular2/src/core/directives/ng_class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class NgClass implements DoCheck, OnDestroy {
private _rawClass;

constructor(private _iterableDiffers: IterableDiffers, private _keyValueDiffers: KeyValueDiffers,
private _ngEl: ElementRef_, private _renderer: Renderer) {}
private _ngEl: ElementRef, private _renderer: Renderer) {}

set initialClasses(v) {
this._applyInitialClasses(true);
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/core/directives/ng_style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class NgStyle implements DoCheck {
_rawStyle;
_differ: KeyValueDiffer;

constructor(private _differs: KeyValueDiffers, private _ngEl: ElementRef_,
constructor(private _differs: KeyValueDiffers, private _ngEl: ElementRef,
private _renderer: Renderer) {}

set rawStyle(v) {
Expand Down
4 changes: 2 additions & 2 deletions modules/angular2/src/core/facade.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Public API for Facade
export {Type} from './facade/lang';
export {ConcreteType, Type} from './facade/lang';
export {Observable, EventEmitter} from './facade/async';
export {Predicate} from './facade/collection';
export {WrappedException} from './facade/exceptions';
export {WrappedException} from './facade/exceptions';
3 changes: 1 addition & 2 deletions modules/angular2/src/core/linker/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ import {ElementRef} from './element_ref';
import {ProtoPipes} from 'angular2/src/core/pipes/pipes';
import {camelCaseToDashCase} from 'angular2/src/core/render/dom/util';
import {TemplateCmd} from './template_commands';
import {ViewRef_} from "./view_ref";
import {ProtoViewRef_} from "./view_ref";
import {ViewRef_, ProtoViewRef_} from "./view_ref";

export {DebugContext} from 'angular2/src/core/change_detection/interfaces';

Expand Down
6 changes: 2 additions & 4 deletions modules/angular2/src/core/linker/view_manager_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import * as eli from './element_injector';
import {isPresent, isBlank} from 'angular2/src/core/facade/lang';
import * as viewModule from './view';
import * as avmModule from './view_manager';
import {ElementRef} from './element_ref';
import {TemplateRef} from './template_ref';
import {ElementRef, ElementRef_} from './element_ref';
import {TemplateRef, TemplateRef_} from './template_ref';
import {Renderer, RenderViewWithFragments} from 'angular2/src/core/render/api';
import {Locals} from 'angular2/src/core/change_detection/change_detection';
import {Pipes} from 'angular2/src/core/pipes/pipes';
import {TemplateRef_} from "./template_ref";
import {ElementRef_} from "./element_ref";

@Injectable()
export class AppViewManagerUtils {
Expand Down
2 changes: 2 additions & 0 deletions modules/angular2/src/core/render/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ export interface RenderElementRef {
renderView: RenderViewRef;

/**
* @internal
*
* Index of the Element (in the depth-first order) inside the Render View.
*
* This index is used internally by Angular to locate elements.
Expand Down
3 changes: 1 addition & 2 deletions modules/angular2/src/core/testability/testability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {Map, MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection';
import {CONST, CONST_EXPR} from 'angular2/src/core/facade/lang';
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
import {NgZone} from '../zone/ng_zone';
import {NgZone, NgZone_} from '../zone/ng_zone';
import {PromiseWrapper} from 'angular2/src/core/facade/async';
import {NgZone_} from "../zone/ng_zone";


/**
Expand Down
3 changes: 1 addition & 2 deletions modules/angular2/src/router/path_recognizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import {Map, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collec

import {RouteHandler} from './route_handler';
import {Url, RootUrl, serializeParams} from './url_parser';
import {ComponentInstruction} from './instruction';
import {ComponentInstruction_} from "./instruction";
import {ComponentInstruction, ComponentInstruction_} from "./instruction";

class TouchMap {
map: {[key: string]: string} = {};
Expand Down
9 changes: 6 additions & 3 deletions modules/angular2/src/test_lib/test_injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ import {APP_ID} from 'angular2/src/core/application_tokens';
import {Serializer} from "angular2/src/web_workers/shared/serializer";
import {Log} from './utils';
import {compilerBindings} from 'angular2/src/core/compiler/compiler';
import {DomRenderer_} from "../core/render/dom/dom_renderer";
import {DynamicComponentLoader_} from "../core/linker/dynamic_component_loader";
import {AppViewManager_} from "../core/linker/view_manager";

/**
* Returns the root injector bindings.
Expand Down Expand Up @@ -93,13 +96,13 @@ function _getAppBindings() {
compilerBindings(),
bind(ChangeDetectorGenConfig).toValue(new ChangeDetectorGenConfig(true, true, false, true)),
bind(DOCUMENT).toValue(appDoc),
DomRenderer,
bind(DomRenderer).toClass(DomRenderer_),
bind(Renderer).toAlias(DomRenderer),
bind(APP_ID).toValue('a'),
DomSharedStylesHost,
bind(SharedStylesHost).toAlias(DomSharedStylesHost),
AppViewPool,
AppViewManager,
bind(AppViewManager).toClass(AppViewManager_),
AppViewManagerUtils,
Serializer,
ELEMENT_PROBE_BINDINGS,
Expand All @@ -111,7 +114,7 @@ function _getAppBindings() {
bind(IterableDiffers).toValue(defaultIterableDiffers),
bind(KeyValueDiffers).toValue(defaultKeyValueDiffers),
Log,
DynamicComponentLoader,
bind(DynamicComponentLoader).toClass(DynamicComponentLoader_),
PipeResolver,
bind(ExceptionHandler).toValue(new ExceptionHandler(DOM)),
bind(LocationStrategy).toClass(MockLocationStrategy),
Expand Down
3 changes: 1 addition & 2 deletions modules/angular2/src/tools/common_tools.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {LifeCycle} from 'angular2/angular2';
import {ComponentRef} from 'angular2/src/core/linker/dynamic_component_loader';
import {ComponentRef, ComponentRef_} from 'angular2/src/core/linker/dynamic_component_loader';
import {isPresent, NumberWrapper} from 'angular2/src/core/facade/lang';
import {performance, window} from 'angular2/src/core/facade/browser';
import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {ComponentRef_} from "../core/linker/dynamic_component_loader";

/**
* Entry point for all Angular debug tools. This object corresponds to the `ng`
Expand Down
3 changes: 1 addition & 2 deletions modules/angular2/src/web_workers/shared/post_message_bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptio
import {EventEmitter} from 'angular2/src/core/facade/async';
import {StringMapWrapper} from 'angular2/src/core/facade/collection';
import {Injectable} from "angular2/src/core/di";
import {NgZone} from 'angular2/src/core/zone/ng_zone';
import {NgZone_} from "../../core/zone/ng_zone";
import {NgZone, NgZone_} from 'angular2/src/core/zone/ng_zone';

/**
* A TypeScript implementation of {@link MessageBus} for communicating via JavaScript's
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import {
fakeAsync
} from 'angular2/test_lib';

import {ChangeDetectorRef} from 'angular2/src/core/change_detection/change_detector_ref';
import {
ChangeDetectorRef,
ChangeDetectorRef_
} from 'angular2/src/core/change_detection/change_detector_ref';
import {SpyChangeDetector} from '../spies';
import {ChangeDetectorRef_} from "../../../src/core/change_detection/change_detector_ref";


export function main() {
Expand Down
4 changes: 3 additions & 1 deletion modules/angular2/test/core/linker/compiler_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {Compiler} from 'angular2/src/core/linker/compiler';
import {ProtoViewFactory} from 'angular2/src/core/linker/proto_view_factory';
import {reflector, ReflectionInfo} from 'angular2/src/core/reflection/reflection';
import {AppProtoView} from 'angular2/src/core/linker/view';
import {Compiler_} from "../../../src/core/linker/compiler";

export function main() {
describe('Compiler', () => {
Expand All @@ -36,7 +37,8 @@ export function main() {
protoViewFactorySpy = new SpyProtoViewFactory();
someProtoView = new AppProtoView(null, null, null, null, null, null);
protoViewFactorySpy.spy('createHost').andReturn(someProtoView);
return [bind(ProtoViewFactory).toValue(protoViewFactorySpy), Compiler];
return
[bind(ProtoViewFactory).toValue(protoViewFactorySpy), bind(Compiler).toClass(Compiler_)];
});

beforeEach(inject([Compiler], (_compiler) => {
Expand Down
3 changes: 1 addition & 2 deletions modules/angular2/test/core/linker/element_injector_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@ import {
import {OnDestroy} from 'angular2/lifecycle_hooks';
import {bind, Injector, Binding, Optional, Inject, Injectable, Self, SkipSelf, InjectMetadata, Host, HostMetadata, SkipSelfMetadata} from 'angular2/core';
import {ViewContainerRef} from 'angular2/src/core/linker/view_container_ref';
import {TemplateRef} from 'angular2/src/core/linker/template_ref';
import {TemplateRef, TemplateRef_} from 'angular2/src/core/linker/template_ref';
import {ElementRef} from 'angular2/src/core/linker/element_ref';
import {DynamicChangeDetector, ChangeDetectorRef, Parser, Lexer} from 'angular2/src/core/change_detection/change_detection';
import {QueryList} from 'angular2/src/core/linker/query_list';
import {AppView, AppViewContainer} from "angular2/src/core/linker/view";
import {TemplateRef_} from "../../../src/core/linker/template_ref";

function createDummyView(detector = null): AppView {
var res = new SpyView();
Expand Down
6 changes: 3 additions & 3 deletions modules/angular2/test/core/linker/integration_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ import {
import {QueryList} from 'angular2/src/core/linker/query_list';

import {ViewContainerRef} from 'angular2/src/core/linker/view_container_ref';
import {ViewRef} from 'angular2/src/core/linker/view_ref';
import {ViewRef, ViewRef_} from 'angular2/src/core/linker/view_ref';

import {Compiler} from 'angular2/src/core/linker/compiler';
import {ElementRef} from 'angular2/src/core/linker/element_ref';
import {TemplateRef} from 'angular2/src/core/linker/template_ref';

import {DomRenderer} from 'angular2/src/core/render/dom/dom_renderer';
import {IS_DART} from '../../platform';
import {ViewRef_} from "../../../src/core/linker/view_ref";
import {Compiler_} from "../../../src/core/linker/compiler";

const ANCHOR_ELEMENT = CONST_EXPR(new OpaqueToken('AnchorElement'));

Expand Down Expand Up @@ -1020,7 +1020,7 @@ export function main() {
describe('dynamic ViewContainers', () => {

it('should allow to create a ViewContainerRef at any bound location',
inject([TestComponentBuilder, AsyncTestCompleter, Compiler],
inject([TestComponentBuilder, AsyncTestCompleter, bind(Compiler).toClass(Compiler_)],
(tcb: TestComponentBuilder, async, compiler) => {
tcb.overrideView(MyComp, new ViewMetadata({
template: '<div><dynamic-vp #dynamic></dynamic-vp></div>',
Expand Down
9 changes: 3 additions & 6 deletions modules/angular2/test/core/linker/view_container_ref_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ import {

import {SpyView, SpyAppViewManager} from '../spies';
import {AppView, AppViewContainer} from 'angular2/src/core/linker/view';
import {ViewContainerRef} from 'angular2/src/core/linker/view_container_ref';
import {ElementRef} from 'angular2/src/core/linker/element_ref';
import {ViewRef} from 'angular2/src/core/linker/view_ref';
import {ViewContainerRef_} from "../../../src/core/linker/view_container_ref";
import {ViewRef_} from "../../../src/core/linker/view_ref";
import {ElementRef_} from "../../../src/core/linker/element_ref";
import {ViewContainerRef, ViewContainerRef_} from 'angular2/src/core/linker/view_container_ref';
import {ElementRef, ElementRef_} from 'angular2/src/core/linker/element_ref';
import {ViewRef, ViewRef_} from 'angular2/src/core/linker/view_ref';

export function main() {
// TODO(tbosch): add missing tests
Expand Down
16 changes: 9 additions & 7 deletions modules/angular2/test/core/linker/view_manager_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,23 @@ import {SpyRenderer, SpyAppViewPool, SpyAppViewListener, SpyProtoViewFactory} fr
import {Injector, bind} from 'angular2/core';

import {AppProtoView, AppView, AppViewContainer, ViewType} from 'angular2/src/core/linker/view';
import {ProtoViewRef, ViewRef, internalView} from 'angular2/src/core/linker/view_ref';
import {
ProtoViewRef,
ProtoViewRef_,
ViewRef,
ViewRef_,
internalView
} from 'angular2/src/core/linker/view_ref';
import {ElementRef} from 'angular2/src/core/linker/element_ref';
import {TemplateRef} from 'angular2/src/core/linker/template_ref';
import {TemplateRef, TemplateRef_} from 'angular2/src/core/linker/template_ref';
import {
Renderer,
RenderViewRef,
RenderProtoViewRef,
RenderFragmentRef,
RenderViewWithFragments
} from 'angular2/src/core/render/api';
import {AppViewManager} from 'angular2/src/core/linker/view_manager';
import {AppViewManager, AppViewManager_} from 'angular2/src/core/linker/view_manager';
import {AppViewManagerUtils} from 'angular2/src/core/linker/view_manager_utils';

import {
Expand All @@ -38,10 +44,6 @@ import {
createNestedElBinder,
createProtoElInjector
} from './view_manager_utils_spec';
import {ProtoViewRef_} from "../../../src/core/linker/view_ref";
import {ViewRef_} from "../../../src/core/linker/view_ref";
import {AppViewManager_} from "../../../src/core/linker/view_manager";
import {TemplateRef_} from "../../../src/core/linker/template_ref";

export function main() {
// TODO(tbosch): add missing tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ import {
EventManagerPlugin,
DomEventsPlugin
} from 'angular2/src/core/render/dom/events/event_manager';
import {NgZone} from 'angular2/src/core/zone/ng_zone';
import {NgZone, NgZone_} from 'angular2/src/core/zone/ng_zone';
import {ListWrapper, Map, MapWrapper} from 'angular2/src/core/facade/collection';
import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {NgZone_} from "../../../../../src/core/zone/ng_zone";

export function main() {
var domEventPlugin;
Expand Down
Loading

0 comments on commit 5458036

Please sign in to comment.