@@ -188,3 +188,39 @@ describe ('rngScript', function() {
188188 expect ( 'foo/../my-angular-app-0.9.0-de0a8612.min.js' . match ( rngScript ) ) . toBeNull ( ) ;
189189 } ) ;
190190} ) ;
191+
192+
193+ describe ( 'angularJsConfig' , function ( ) {
194+ it ( 'should find angular.js script tag and config' , function ( ) {
195+ var doc = { getElementsByTagName : function ( tagName ) {
196+ expect ( tagName ) . toEqual ( 'script' ) ;
197+ return [ { nodeName : 'SCRIPT' , src : 'random.js' } ,
198+ { nodeName : 'SCRIPT' , src : 'angular.js' } ,
199+ { nodeName : 'SCRIPT' , src : 'my-angular-app.js' } ] ;
200+ }
201+ } ;
202+
203+ expect ( angularJsConfig ( doc ) ) . toEqual ( { base_url : '' ,
204+ ie_compat : 'angular-ie-compat.js' ,
205+ ie_compat_id : 'ng-ie-compat' } ) ;
206+ } ) ;
207+
208+
209+ it ( 'should extract angular config from the ng: attributes' , function ( ) {
210+ var doc = { getElementsByTagName : function ( tagName ) {
211+ expect ( lowercase ( tagName ) ) . toEqual ( 'script' ) ;
212+ return [ { nodeName : 'SCRIPT' ,
213+ src : 'angularjs/angular.js' ,
214+ attributes : [ { name : 'ng:autobind' , value :undefined } ,
215+ { name : 'ng:css' , value : 'css/my_custom_angular.css' } ,
216+ { name : 'ng:ie-compat' , value : 'myjs/angular-ie-compat.js' } ,
217+ { name : 'ng:ie-compat-id' , value : 'ngcompat' } ] } ] ;
218+ } } ;
219+
220+ expect ( angularJsConfig ( doc ) ) . toEqual ( { base_url : 'angularjs/' ,
221+ autobind : true ,
222+ css : 'css/my_custom_angular.css' ,
223+ ie_compat : 'myjs/angular-ie-compat.js' ,
224+ ie_compat_id : 'ngcompat' } ) ;
225+ } ) ;
226+ } ) ;
0 commit comments