@@ -17,7 +17,7 @@ import {Type, isBlank, stringify, isPresent} from 'angular2/src/facade/lang';
1717import { PromiseWrapper , Promise } from 'angular2/src/facade/async' ;
1818
1919import { Compiler , CompilerCache } from 'angular2/src/render/dom/compiler/compiler' ;
20- import { ProtoViewDto , ViewDefinition } from 'angular2/src/render/api' ;
20+ import { ProtoViewDto , ViewDefinition , DirectiveMetadata } from 'angular2/src/render/api' ;
2121import { CompileElement } from 'angular2/src/render/dom/compiler/compile_element' ;
2222import { CompileStep } from 'angular2/src/render/dom/compiler/compile_step'
2323import { CompileStepFactory } from 'angular2/src/render/dom/compiler/compile_step_factory' ;
@@ -54,6 +54,22 @@ export function runCompilerCommonTests() {
5454 } ) ;
5555 } ) ) ;
5656
57+ it ( 'should run the steps and build the proto view' , inject ( [ AsyncTestCompleter ] , ( async ) => {
58+ var compiler = createCompiler ( ( parent , current , control ) => {
59+ current . inheritedProtoView . bindVariable ( 'b' , 'a' ) ;
60+ } ) ;
61+
62+ var dirMetadata = new DirectiveMetadata ( { id : 'id' , selector : 'CUSTOM' , type : DirectiveMetadata . COMPONENT_TYPE } ) ;
63+ compiler . compileHost ( dirMetadata ) . then ( ( protoView ) => {
64+ expect ( DOM . tagName ( protoView . render . delegate . element ) ) . toEqual ( 'CUSTOM' )
65+ expect ( mockStepFactory . viewDef . directives ) . toEqual ( [ dirMetadata ] ) ;
66+ expect ( protoView . variableBindings ) . toEqual ( MapWrapper . createFromStringMap ( {
67+ 'a' : 'b'
68+ } ) ) ;
69+ async . done ( ) ;
70+ } ) ;
71+ } ) ) ;
72+
5773 it ( 'should use the inline template and compile in sync' , inject ( [ AsyncTestCompleter ] , ( async ) => {
5874 var compiler = createCompiler ( EMPTY_STEP ) ;
5975 compiler . compile ( new ViewDefinition ( {
@@ -124,11 +140,14 @@ export function runCompilerCommonTests() {
124140class MockStepFactory extends CompileStepFactory {
125141 steps :List < CompileStep > ;
126142 subTaskPromises :List < Promise > ;
143+ viewDef :ViewDefinition ;
144+
127145 constructor ( steps ) {
128146 super ( ) ;
129147 this . steps = steps ;
130148 }
131- createSteps ( template , subTaskPromises ) {
149+ createSteps ( viewDef , subTaskPromises ) {
150+ this . viewDef = viewDef ;
132151 this . subTaskPromises = subTaskPromises ;
133152 ListWrapper . forEach ( this . subTaskPromises , ( p ) => ListWrapper . push ( subTaskPromises , p ) ) ;
134153 return this . steps ;
0 commit comments