refactor(ProtoViewDto): switch to enum
This commit is contained in:
@ -317,7 +317,7 @@ export function main() {
|
||||
createRenderProtoView([
|
||||
createRenderViewportElementBinder(
|
||||
createRenderProtoView([createRenderComponentElementBinder(0)],
|
||||
renderApi.ProtoViewDto.EMBEDDED_VIEW_TYPE))
|
||||
renderApi.ViewType.EMBEDDED))
|
||||
]),
|
||||
createRenderProtoView()
|
||||
],
|
||||
@ -379,7 +379,7 @@ export function main() {
|
||||
renderCompiler.spy('compileHost')
|
||||
.andCallFake((componentId) => {
|
||||
return PromiseWrapper.resolve(createRenderProtoView(
|
||||
[createRenderComponentElementBinder(0)], renderApi.ProtoViewDto.HOST_VIEW_TYPE));
|
||||
[createRenderComponentElementBinder(0)], renderApi.ViewType.HOST));
|
||||
});
|
||||
tplResolver.setView(MainComponent, new viewAnn.View({template: '<div></div>'}));
|
||||
var rootProtoView =
|
||||
@ -429,9 +429,9 @@ function createViewportElementBinder(nestedProtoView) {
|
||||
return elBinder;
|
||||
}
|
||||
|
||||
function createRenderProtoView(elementBinders = null, type: number = null) {
|
||||
function createRenderProtoView(elementBinders = null, type: renderApi.ViewType = null) {
|
||||
if (isBlank(type)) {
|
||||
type = renderApi.ProtoViewDto.COMPONENT_VIEW_TYPE;
|
||||
type = renderApi.ViewType.COMPONENT;
|
||||
}
|
||||
if (isBlank(elementBinders)) {
|
||||
elementBinders = [];
|
||||
|
@ -146,9 +146,9 @@ function directiveBinding({metadata}: {metadata?: any} = {}) {
|
||||
return new DirectiveBinding(Key.get("dummy"), null, [], false, [], [], [], metadata);
|
||||
}
|
||||
|
||||
function createRenderProtoView(elementBinders = null, type: number = null) {
|
||||
function createRenderProtoView(elementBinders = null, type: renderApi.ViewType = null) {
|
||||
if (isBlank(type)) {
|
||||
type = renderApi.ProtoViewDto.COMPONENT_VIEW_TYPE;
|
||||
type = renderApi.ViewType.COMPONENT;
|
||||
}
|
||||
if (isBlank(elementBinders)) {
|
||||
elementBinders = [];
|
||||
|
@ -17,7 +17,7 @@ import {Type, isBlank, stringify, isPresent} from 'angular2/src/facade/lang';
|
||||
import {PromiseWrapper, Promise} from 'angular2/src/facade/async';
|
||||
|
||||
import {DomCompiler} from 'angular2/src/render/dom/compiler/compiler';
|
||||
import {ProtoViewDto, ViewDefinition, DirectiveMetadata} from 'angular2/src/render/api';
|
||||
import {ProtoViewDto, ViewDefinition, DirectiveMetadata, ViewType} from 'angular2/src/render/api';
|
||||
import {CompileElement} from 'angular2/src/render/dom/compiler/compile_element';
|
||||
import {CompileStep} from 'angular2/src/render/dom/compiler/compile_step';
|
||||
import {CompileStepFactory} from 'angular2/src/render/dom/compiler/compile_step_factory';
|
||||
@ -140,7 +140,7 @@ export function runCompilerCommonTests() {
|
||||
compiler.compile(
|
||||
new ViewDefinition({componentId: 'someId', template: 'inline component'}))
|
||||
.then((protoView) => {
|
||||
expect(protoView.type).toEqual(ProtoViewDto.COMPONENT_VIEW_TYPE);
|
||||
expect(protoView.type).toEqual(ViewType.COMPONENT);
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
@ -154,7 +154,7 @@ export function runCompilerCommonTests() {
|
||||
var compiler = createCompiler(EMPTY_STEP);
|
||||
compiler.compileHost(someComponent)
|
||||
.then((protoView) => {
|
||||
expect(protoView.type).toEqual(ProtoViewDto.HOST_VIEW_TYPE);
|
||||
expect(protoView.type).toEqual(ViewType.HOST);
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
|
@ -9,7 +9,7 @@ import {CompileStep} from 'angular2/src/render/dom/compiler/compile_step';
|
||||
import {CompileControl} from 'angular2/src/render/dom/compiler/compile_control';
|
||||
|
||||
import {ProtoViewBuilder} from 'angular2/src/render/dom/view/proto_view_builder';
|
||||
import {ProtoViewDto} from 'angular2/src/render/api';
|
||||
import {ProtoViewDto, ViewType} from 'angular2/src/render/api';
|
||||
|
||||
export function main() {
|
||||
describe('compile_pipeline', () => {
|
||||
@ -43,7 +43,7 @@ export function main() {
|
||||
new MockStep((parent, current, control) => {
|
||||
if (isPresent(DOM.getAttribute(current.element, 'viewroot'))) {
|
||||
current.inheritedProtoView =
|
||||
new ProtoViewBuilder(current.element, ProtoViewDto.EMBEDDED_VIEW_TYPE);
|
||||
new ProtoViewBuilder(current.element, ViewType.EMBEDDED);
|
||||
}
|
||||
})
|
||||
]);
|
||||
|
@ -12,7 +12,7 @@ import {MapWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {ViewSplitter} from 'angular2/src/render/dom/compiler/view_splitter';
|
||||
import {CompilePipeline} from 'angular2/src/render/dom/compiler/compile_pipeline';
|
||||
import {ProtoViewDto} from 'angular2/src/render/api';
|
||||
import {ProtoViewDto, ViewType} from 'angular2/src/render/api';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
|
||||
import {Lexer, Parser} from 'angular2/change_detection';
|
||||
@ -68,7 +68,7 @@ export function main() {
|
||||
expect(results[2].inheritedProtoView).not.toBe(null);
|
||||
expect(results[2].inheritedProtoView)
|
||||
.toBe(results[1].inheritedElementBinder.nestedProtoView);
|
||||
expect(results[2].inheritedProtoView.type).toBe(ProtoViewDto.EMBEDDED_VIEW_TYPE);
|
||||
expect(results[2].inheritedProtoView.type).toBe(ViewType.EMBEDDED);
|
||||
expect(stringifyElement(results[2].inheritedProtoView.rootElement))
|
||||
.toEqual('<template>a</template>');
|
||||
});
|
||||
|
Reference in New Issue
Block a user