chore(docs): added more docs for core.ts

This commit is contained in:
Misko Hevery
2015-07-11 17:26:48 +02:00
parent 0906ee8a4e
commit c83a3f3372
48 changed files with 414 additions and 180 deletions

View File

@ -14,7 +14,7 @@ import {
PreGeneratedChangeDetection,
ChangeDetectorDefinition,
DynamicProtoChangeDetector
} from 'angular2/change_detection';
} from 'angular2/src/change_detection/change_detection';
export function main() {
describe("PreGeneratedChangeDetection", () => {

View File

@ -10,7 +10,7 @@ import {
Lexer,
Locals,
Parser
} from 'angular2/change_detection';
} from 'angular2/src/change_detection/change_detection';
import {reflector} from 'angular2/src/reflection/reflection';
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';

View File

@ -44,7 +44,7 @@ import {
Parser,
Locals,
ProtoChangeDetector
} from 'angular2/change_detection';
} from 'angular2/src/change_detection/change_detection';
import {JitProtoChangeDetector} from 'angular2/src/change_detection/jit_proto_change_detector';
import {getDefinition} from './change_detector_config';

View File

@ -45,7 +45,7 @@ import {AppProtoView, AppView} from 'angular2/src/core/compiler/view';
import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
import {TemplateRef} from 'angular2/src/core/compiler/template_ref';
import {ElementRef} from 'angular2/src/core/compiler/element_ref';
import {DynamicChangeDetector, ChangeDetectorRef, Parser, Lexer} from 'angular2/change_detection';
import {DynamicChangeDetector, ChangeDetectorRef, Parser, Lexer} from 'angular2/src/change_detection/change_detection';
import {QueryList} from 'angular2/src/core/compiler/query_list';
@proxy

View File

@ -53,7 +53,7 @@ import {
Pipe,
ChangeDetectorRef,
ON_PUSH
} from 'angular2/change_detection';
} from 'angular2/src/change_detection/change_detection';
import {Directive, Component, View, Attribute, Query} from 'angular2/annotations';
import * as viewAnn from 'angular2/src/core/annotations_impl/view';

View File

@ -17,7 +17,10 @@ import {
import {isBlank, IMPLEMENTS, stringify} from 'angular2/src/facade/lang';
import {MapWrapper} from 'angular2/src/facade/collection';
import {ChangeDetection, ChangeDetectorDefinition} from 'angular2/change_detection';
import {
ChangeDetection,
ChangeDetectorDefinition
} from 'angular2/src/change_detection/change_detection';
import {
ProtoViewFactory,
getChangeDetectorDefinitions,

View File

@ -115,21 +115,23 @@ export function main() {
() => { hostProtoView = createHostPv([createNestedElBinder(createComponentPv())]); });
it('should create the view', () => {
var rootView = internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null));
var rootView =
internalView(<ViewRef>manager.createRootHostView(wrapPv(hostProtoView), null, null));
expect(rootView.proto).toBe(hostProtoView);
expect(viewListener.spy('viewCreated')).toHaveBeenCalledWith(rootView);
});
it('should hydrate the view', () => {
var injector = Injector.resolveAndCreate([]);
var rootView =
internalView(manager.createRootHostView(wrapPv(hostProtoView), null, injector));
var rootView = internalView(
<ViewRef>manager.createRootHostView(wrapPv(hostProtoView), null, injector));
expect(rootView.hydrated()).toBe(true);
expect(renderer.spy('hydrateView')).toHaveBeenCalledWith(rootView.render);
});
it('should create and set the render view using the component selector', () => {
var rootView = internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null));
var rootView =
internalView(<ViewRef>manager.createRootHostView(wrapPv(hostProtoView), null, null));
expect(renderer.spy('createRootHostView'))
.toHaveBeenCalledWith(hostProtoView.mergeMapping.renderProtoViewRef,
hostProtoView.mergeMapping.renderFragmentCount, 'someComponent');
@ -139,14 +141,15 @@ export function main() {
it('should allow to override the selector', () => {
var selector = 'someOtherSelector';
internalView(manager.createRootHostView(wrapPv(hostProtoView), selector, null));
internalView(<ViewRef>manager.createRootHostView(wrapPv(hostProtoView), selector, null));
expect(renderer.spy('createRootHostView'))
.toHaveBeenCalledWith(hostProtoView.mergeMapping.renderProtoViewRef,
hostProtoView.mergeMapping.renderFragmentCount, selector);
});
it('should set the event dispatcher', () => {
var rootView = internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null));
var rootView =
internalView(<ViewRef>manager.createRootHostView(wrapPv(hostProtoView), null, null));
expect(renderer.spy('setEventDispatcher')).toHaveBeenCalledWith(rootView.render, rootView);
});
@ -159,7 +162,8 @@ export function main() {
var hostRenderViewRef: RenderViewRef;
beforeEach(() => {
hostProtoView = createHostPv([createNestedElBinder(createComponentPv())]);
hostView = internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null));
hostView =
internalView(<ViewRef>manager.createRootHostView(wrapPv(hostProtoView), null, null));
hostRenderViewRef = hostView.render;
});
@ -193,7 +197,8 @@ export function main() {
childProtoView = createEmbeddedPv();
var hostProtoView = createHostPv(
[createNestedElBinder(createComponentPv([createNestedElBinder(childProtoView)]))]);
hostView = internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null));
hostView =
internalView(<ViewRef>manager.createRootHostView(wrapPv(hostProtoView), null, null));
vcRef = hostView.elementRefs[1];
templateRef = new TemplateRef(hostView.elementRefs[1]);
resetSpies();
@ -307,8 +312,8 @@ export function main() {
it('should always create a new view and not use the embedded view', () => {
var newHostPv = createHostPv([createNestedElBinder(createComponentPv())]);
var newHostView =
internalView(manager.createHostViewInContainer(vcRef, 0, wrapPv(newHostPv), null));
var newHostView = internalView(
<ViewRef>manager.createHostViewInContainer(vcRef, 0, wrapPv(newHostPv), null));
expect(newHostView.proto).toBe(newHostPv);
expect(newHostView).not.toBe(hostView.views[2]);
expect(viewListener.spy('viewCreated')).toHaveBeenCalledWith(newHostView);
@ -334,7 +339,8 @@ export function main() {
childProtoView = createEmbeddedPv();
var hostProtoView = createHostPv(
[createNestedElBinder(createComponentPv([createNestedElBinder(childProtoView)]))]);
hostView = internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null));
hostView =
internalView(<ViewRef>manager.createRootHostView(wrapPv(hostProtoView), null, null));
vcRef = hostView.elementRefs[1];
templateRef = new TemplateRef(hostView.elementRefs[1]);
firstChildView =
@ -405,7 +411,8 @@ export function main() {
childProtoView = createEmbeddedPv();
var hostProtoView = createHostPv(
[createNestedElBinder(createComponentPv([createNestedElBinder(childProtoView)]))]);
hostView = internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null));
hostView = internalView(
<ViewRef>manager.createRootHostView(wrapPv(hostProtoView), null, null));
vcRef = hostView.elementRefs[1];
templateRef = new TemplateRef(hostView.elementRefs[1]);
firstChildView =
@ -457,7 +464,8 @@ export function main() {
]);
var hostProtoView = createHostPv(
[createNestedElBinder(createComponentPv([createNestedElBinder(childProtoView)]))]);
hostView = internalView(manager.createRootHostView(wrapPv(hostProtoView), null, null));
hostView = internalView(
<ViewRef>manager.createRootHostView(wrapPv(hostProtoView), null, null));
vcRef = hostView.elementRefs[1];
templateRef = new TemplateRef(hostView.elementRefs[1]);
nestedChildViews = [];

View File

@ -8,7 +8,7 @@ import {CompileStep} from 'angular2/src/render/dom/compiler/compile_step';
import {CompileElement} from 'angular2/src/render/dom/compiler/compile_element';
import {CompileControl} from 'angular2/src/render/dom/compiler/compile_control';
import {ViewDefinition, DirectiveMetadata} from 'angular2/src/render/api';
import {Lexer, Parser} from 'angular2/change_detection';
import {Lexer, Parser} from 'angular2/src/change_detection/change_detection';
import {ElementBinderBuilder} from 'angular2/src/render/dom/view/proto_view_builder';
export function main() {

View File

@ -6,7 +6,7 @@ import {MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
import {CompileElement} from 'angular2/src/render/dom/compiler/compile_element';
import {CompileStep} from 'angular2/src/render/dom/compiler/compile_step';
import {CompileControl} from 'angular2/src/render/dom/compiler/compile_control';
import {Lexer, Parser} from 'angular2/change_detection';
import {Lexer, Parser} from 'angular2/src/change_detection/change_detection';
import {ElementBinderBuilder} from 'angular2/src/render/dom/view/proto_view_builder';
var EMPTY_MAP = new Map();

View File

@ -2,7 +2,7 @@ import {describe, beforeEach, expect, it, iit, ddescribe, el} from 'angular2/tes
import {TextInterpolationParser} from 'angular2/src/render/dom/compiler/text_interpolation_parser';
import {CompilePipeline} from 'angular2/src/render/dom/compiler/compile_pipeline';
import {MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
import {Lexer, Parser, ASTWithSource} from 'angular2/change_detection';
import {Lexer, Parser, ASTWithSource} from 'angular2/src/change_detection/change_detection';
import {IgnoreChildrenStep} from './pipeline_spec';
import {
ProtoViewBuilder,

View File

@ -15,7 +15,7 @@ import {CompilePipeline} from 'angular2/src/render/dom/compiler/compile_pipeline
import {ProtoViewDto, ViewType} from 'angular2/src/render/api';
import {DOM} from 'angular2/src/dom/dom_adapter';
import {Lexer, Parser} from 'angular2/change_detection';
import {Lexer, Parser} from 'angular2/src/change_detection/change_detection';
export function main() {
describe('ViewSplitter', () => {

View File

@ -12,7 +12,7 @@ import {
} from 'angular2/test_lib';
import {ProtoViewBuilder} from 'angular2/src/render/dom/view/proto_view_builder';
import {ASTWithSource, AST} from 'angular2/change_detection';
import {ASTWithSource, AST} from 'angular2/src/change_detection/change_detection';
import {PropertyBindingType, ViewType} from 'angular2/src/render/api';
import {DOM} from 'angular2/src/dom/dom_adapter';

View File

@ -16,7 +16,7 @@ import {
} from 'angular2/test_lib';
import {TimerWrapper, PromiseWrapper} from 'angular2/src/facade/async';
import {BaseException, global} from 'angular2/src/facade/lang';
import {Parser} from 'angular2/change_detection';
import {Parser} from 'angular2/src/change_detection/change_detection';
export function main() {
describe('fake async', () => {