@@ -26,4 +26,41 @@ describe('BaseApp', function() {
2626 new MyApp ( ) ;
2727 } ) ;
2828 } ) ;
29+
30+ describe ( 'constructor' , function ( ) {
31+ context ( 'with a custom templateAdapter module name' , function ( ) {
32+ beforeEach ( function ( ) {
33+ this . attributes = { templateAdapter : '../test/fixtures/app/template_adapter' } ;
34+ } ) ;
35+
36+ it ( 'creates the templateAdapter we specify' , function ( ) {
37+ var app = new App ( this . attributes ) ;
38+
39+ expect ( app . templateAdapter ) . to . have . property ( 'name' , 'Test template adapter' ) ;
40+ } ) ;
41+
42+ it ( 'supplies the entryPath to the template adapter' , function ( ) {
43+ var app = new App ( this . attributes , { entryPath : 'myEntryPath' } ) ;
44+
45+ expect ( app . templateAdapter ) . to . have . deep . property ( 'suppliedOptions.entryPath' , 'myEntryPath' ) ;
46+ } ) ;
47+ } ) ;
48+
49+ context ( 'with a concrete templateAdapterInstance' , function ( ) {
50+ it ( 'uses the supplied templateAdapterInstance' , function ( ) {
51+ var myTemplateAdapter = { } ;
52+ var app = new App ( null , { templateAdapterInstance : myTemplateAdapter } ) ;
53+
54+ expect ( app . templateAdapter ) . to . equal ( myTemplateAdapter ) ;
55+ } ) ;
56+
57+ it ( 'does not try to require a template adapter by name' , function ( ) {
58+ new App ( {
59+ templateAdapter : 'non existent module name - should throw'
60+ } , {
61+ templateAdapterInstance : { }
62+ } ) ;
63+ } ) ;
64+ } ) ;
65+ } ) ;
2966} ) ;
0 commit comments