@@ -373,6 +373,26 @@ export function main() {
373373 } ) ;
374374 } ) ) ;
375375
376+ it ( 'should not bind directives for cached components' , inject ( [ AsyncTestCompleter ] , ( async ) => {
377+ // set up the cache with the test proto view
378+ var mainPv : AppProtoView = createProtoView ( ) ;
379+ var cache : CompilerCache = new CompilerCache ( ) ;
380+ cache . setHost ( MainComponent , mainPv ) ;
381+
382+ // create the spy resolver
383+ var reader : any = new SpyDirectiveResolver ( ) ;
384+
385+ // create the compiler
386+ var compiler = new Compiler ( reader , cache , tplResolver , cmpUrlMapper , new UrlResolver ( ) ,
387+ renderCompiler , protoViewFactory , new FakeAppRootUrl ( ) ) ;
388+ compiler . compileInHost ( MainComponent )
389+ . then ( ( protoViewRef ) => {
390+ // the test should have failed if the resolver was called, so we're good
391+ async . done ( ) ;
392+ } ) ;
393+ } ) ) ;
394+
395+
376396 it ( 'should cache compiled nested components' , inject ( [ AsyncTestCompleter ] , ( async ) => {
377397 tplResolver . setView ( MainComponent , new viewAnn . View ( { template : '<div></div>' } ) ) ;
378398 tplResolver . setView ( MainComponent2 , new viewAnn . View ( { template : '<div></div>' } ) ) ;
@@ -563,6 +583,13 @@ class SpyRenderCompiler extends SpyObject {
563583 noSuchMethod ( m ) { return super . noSuchMethod ( m ) }
564584}
565585
586+ @proxy
587+ @IMPLEMENTS ( DirectiveResolver )
588+ class SpyDirectiveResolver extends SpyObject {
589+ constructor ( ) { super ( DirectiveResolver ) ; }
590+ noSuchMethod ( m ) { return super . noSuchMethod ( m ) }
591+ }
592+
566593class FakeAppRootUrl extends AppRootUrl {
567594 get value ( ) { return 'http://www.app.com' ; }
568595}
0 commit comments