@@ -17,7 +17,7 @@ import {Type, isBlank, stringify, isPresent} from 'angular2/src/facade/lang';
17
17
import { PromiseWrapper , Promise } from 'angular2/src/facade/async' ;
18
18
19
19
import { 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' ;
21
21
import { CompileElement } from 'angular2/src/render/dom/compiler/compile_element' ;
22
22
import { CompileStep } from 'angular2/src/render/dom/compiler/compile_step'
23
23
import { CompileStepFactory } from 'angular2/src/render/dom/compiler/compile_step_factory' ;
@@ -54,6 +54,22 @@ export function runCompilerCommonTests() {
54
54
} ) ;
55
55
} ) ) ;
56
56
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
+
57
73
it ( 'should use the inline template and compile in sync' , inject ( [ AsyncTestCompleter ] , ( async ) => {
58
74
var compiler = createCompiler ( EMPTY_STEP ) ;
59
75
compiler . compile ( new ViewDefinition ( {
@@ -124,11 +140,14 @@ export function runCompilerCommonTests() {
124
140
class MockStepFactory extends CompileStepFactory {
125
141
steps :List < CompileStep > ;
126
142
subTaskPromises :List < Promise > ;
143
+ viewDef :ViewDefinition ;
144
+
127
145
constructor ( steps ) {
128
146
super ( ) ;
129
147
this . steps = steps ;
130
148
}
131
- createSteps ( template , subTaskPromises ) {
149
+ createSteps ( viewDef , subTaskPromises ) {
150
+ this . viewDef = viewDef ;
132
151
this . subTaskPromises = subTaskPromises ;
133
152
ListWrapper . forEach ( this . subTaskPromises , ( p ) => ListWrapper . push ( subTaskPromises , p ) ) ;
134
153
return this . steps ;
0 commit comments