@@ -12,7 +12,7 @@ import {
1212} from 'angular2/test_lib' ;
1313import { bootstrap , appDocumentToken , appElementToken }
1414 from 'angular2/src/core/application' ;
15- import { Component } from 'angular2/src/core/annotations/annotations' ;
15+ import { Component , Decorator } from 'angular2/src/core/annotations/annotations' ;
1616import { DOM } from 'angular2/src/dom/dom_adapter' ;
1717import { ListWrapper } from 'angular2/src/facade/collection' ;
1818import { PromiseWrapper } from 'angular2/src/facade/async' ;
@@ -64,6 +64,12 @@ class HelloRootCmp4 {
6464 }
6565}
6666
67+ @Component ( { selector : 'hello-app' } )
68+ class HelloRootMissingTemplate { }
69+
70+ @Decorator ( { selector : 'hello-app' } )
71+ class HelloRootDirectiveIsNotCmp { }
72+
6773export function main ( ) {
6874 var fakeDoc , el , el2 , testBindings , lightDom ;
6975
@@ -80,6 +86,23 @@ export function main() {
8086 } ) ;
8187
8288 describe ( 'bootstrap factory method' , ( ) => {
89+ it ( 'should throw if no Template found' , inject ( [ AsyncTestCompleter ] , ( async ) => {
90+ var injectorPromise = bootstrap ( HelloRootMissingTemplate , testBindings , ( e , t ) => { throw e ; } ) ;
91+ PromiseWrapper . then ( injectorPromise , null , ( reason ) => {
92+ expect ( reason . message ) . toContain ( 'No template found for HelloRootMissingTemplate' ) ;
93+ async . done ( ) ;
94+ } ) ;
95+ } ) ) ;
96+
97+ it ( 'should throw if bootstrapped Directive is not a Component' , inject ( [ AsyncTestCompleter ] , ( async ) => {
98+ var injectorPromise = bootstrap ( HelloRootDirectiveIsNotCmp , testBindings , ( e , t ) => { throw e ; } ) ;
99+ PromiseWrapper . then ( injectorPromise , null , ( reason ) => {
100+ expect ( reason . message ) . toContain ( 'Only Components can be bootstrapped; ' +
101+ 'Directive of HelloRootDirectiveIsNotCmp is not a Component' ) ;
102+ async . done ( ) ;
103+ } ) ;
104+ } ) ) ;
105+
83106 it ( 'should throw if no element is found' , inject ( [ AsyncTestCompleter ] , ( async ) => {
84107 var injectorPromise = bootstrap ( HelloRootCmp , [ ] , ( e , t ) => { throw e ; } ) ;
85108 PromiseWrapper . then ( injectorPromise , null , ( reason ) => {
0 commit comments