@@ -331,6 +331,12 @@ describe('angular', function() {
331
331
return element . getElementById [ id ] || [ ] ;
332
332
} ,
333
333
334
+
335
+ querySelectorAll : function ( arg ) {
336
+ return element . querySelectorAll [ arg ] || [ ] ;
337
+ } ,
338
+
339
+
334
340
getAttribute : function ( name ) {
335
341
return element [ name ] ;
336
342
}
@@ -345,6 +351,14 @@ describe('angular', function() {
345
351
} ) ;
346
352
347
353
354
+ it ( 'should look for ngApp directive as attr' , function ( ) {
355
+ var appElement = jqLite ( '<div ng-app="ABC"></div>' ) [ 0 ] ;
356
+ element . querySelectorAll [ '[ng-app]' ] = [ appElement ] ;
357
+ angularInit ( element , bootstrap ) ;
358
+ expect ( bootstrap ) . toHaveBeenCalledOnceWith ( appElement , [ 'ABC' ] ) ;
359
+ } ) ;
360
+
361
+
348
362
it ( 'should look for ngApp directive in id' , function ( ) {
349
363
var appElement = jqLite ( '<div id="ng-app" data-ng-app="ABC"></div>' ) [ 0 ] ;
350
364
jqLite ( document . body ) . append ( appElement ) ;
@@ -355,7 +369,6 @@ describe('angular', function() {
355
369
356
370
it ( 'should look for ngApp directive in className' , function ( ) {
357
371
var appElement = jqLite ( '<div data-ng-app="ABC"></div>' ) [ 0 ] ;
358
- element . querySelectorAll = function ( arg ) { return element . querySelectorAll [ arg ] || [ ] ; }
359
372
element . querySelectorAll [ '.ng\\:app' ] = [ appElement ] ;
360
373
angularInit ( element , bootstrap ) ;
361
374
expect ( bootstrap ) . toHaveBeenCalledOnceWith ( appElement , [ 'ABC' ] ) ;
@@ -364,7 +377,6 @@ describe('angular', function() {
364
377
365
378
it ( 'should look for ngApp directive using querySelectorAll' , function ( ) {
366
379
var appElement = jqLite ( '<div x-ng-app="ABC"></div>' ) [ 0 ] ;
367
- element . querySelectorAll = function ( arg ) { return element . querySelectorAll [ arg ] || [ ] ; }
368
380
element . querySelectorAll [ '[ng\\:app]' ] = [ appElement ] ;
369
381
angularInit ( element , bootstrap ) ;
370
382
expect ( bootstrap ) . toHaveBeenCalledOnceWith ( appElement , [ 'ABC' ] ) ;
@@ -380,7 +392,6 @@ describe('angular', function() {
380
392
381
393
it ( 'should bootstrap anonymously' , function ( ) {
382
394
var appElement = jqLite ( '<div x-ng-app></div>' ) [ 0 ] ;
383
- element . querySelectorAll = function ( arg ) { return element . querySelectorAll [ arg ] || [ ] ; }
384
395
element . querySelectorAll [ '[x-ng-app]' ] = [ appElement ] ;
385
396
angularInit ( element , bootstrap ) ;
386
397
expect ( bootstrap ) . toHaveBeenCalledOnceWith ( appElement , [ ] ) ;
0 commit comments