@@ -712,16 +712,14 @@ describe('angular', function() {
712
712
713
713
beforeEach ( function ( ) {
714
714
element = {
715
- getElementById : function ( id ) {
716
- return element . getElementById [ id ] || [ ] ;
715
+ hasAttribute : function ( name ) {
716
+ return ! ! element [ name ] ;
717
717
} ,
718
718
719
-
720
- querySelectorAll : function ( arg ) {
721
- return element . querySelectorAll [ arg ] || [ ] ;
719
+ querySelector : function ( arg ) {
720
+ return element . querySelector [ arg ] || null ;
722
721
} ,
723
722
724
-
725
723
getAttribute : function ( name ) {
726
724
return element [ name ] ;
727
725
}
@@ -738,60 +736,30 @@ describe('angular', function() {
738
736
739
737
it ( 'should look for ngApp directive as attr' , function ( ) {
740
738
var appElement = jqLite ( '<div ng-app="ABC"></div>' ) [ 0 ] ;
741
- element . querySelectorAll [ '[ng-app]' ] = [ appElement ] ;
742
- angularInit ( element , bootstrapSpy ) ;
743
- expect ( bootstrapSpy ) . toHaveBeenCalledOnceWith ( appElement , [ 'ABC' ] , jasmine . any ( Object ) ) ;
744
- } ) ;
745
-
746
-
747
- it ( 'should look for ngApp directive in id' , function ( ) {
748
- var appElement = jqLite ( '<div id="ng-app" data-ng-app="ABC"></div>' ) [ 0 ] ;
749
- jqLite ( document . body ) . append ( appElement ) ;
750
- angularInit ( element , bootstrapSpy ) ;
751
- expect ( bootstrapSpy ) . toHaveBeenCalledOnceWith ( appElement , [ 'ABC' ] , jasmine . any ( Object ) ) ;
752
- } ) ;
753
-
754
-
755
- it ( 'should look for ngApp directive in className' , function ( ) {
756
- var appElement = jqLite ( '<div data-ng-app="ABC"></div>' ) [ 0 ] ;
757
- element . querySelectorAll [ '.ng\\:app' ] = [ appElement ] ;
739
+ element . querySelector [ '[ng-app]' ] = appElement ;
758
740
angularInit ( element , bootstrapSpy ) ;
759
741
expect ( bootstrapSpy ) . toHaveBeenCalledOnceWith ( appElement , [ 'ABC' ] , jasmine . any ( Object ) ) ;
760
742
} ) ;
761
743
762
744
763
745
it ( 'should look for ngApp directive using querySelectorAll' , function ( ) {
764
746
var appElement = jqLite ( '<div x-ng-app="ABC"></div>' ) [ 0 ] ;
765
- element . querySelectorAll [ '[ng\\: app]' ] = [ appElement ] ;
747
+ element . querySelector [ '[x-ng- app]' ] = appElement ;
766
748
angularInit ( element , bootstrapSpy ) ;
767
749
expect ( bootstrapSpy ) . toHaveBeenCalledOnceWith ( appElement , [ 'ABC' ] , jasmine . any ( Object ) ) ;
768
750
} ) ;
769
751
770
752
771
- it ( 'should bootstrap using class name' , function ( ) {
772
- var appElement = jqLite ( '<div class="ng-app: ABC;"></div>' ) [ 0 ] ;
773
- angularInit ( jqLite ( '<div></div>' ) . append ( appElement ) [ 0 ] , bootstrapSpy ) ;
774
- expect ( bootstrapSpy ) . toHaveBeenCalledOnceWith ( appElement , [ 'ABC' ] , jasmine . any ( Object ) ) ;
775
- } ) ;
776
-
777
-
778
753
it ( 'should bootstrap anonymously' , function ( ) {
779
754
var appElement = jqLite ( '<div x-ng-app></div>' ) [ 0 ] ;
780
- element . querySelectorAll [ '[x-ng-app]' ] = [ appElement ] ;
755
+ element . querySelector [ '[x-ng-app]' ] = appElement ;
781
756
angularInit ( element , bootstrapSpy ) ;
782
757
expect ( bootstrapSpy ) . toHaveBeenCalledOnceWith ( appElement , [ ] , jasmine . any ( Object ) ) ;
783
758
} ) ;
784
759
785
760
786
- it ( 'should bootstrap anonymously using class only' , function ( ) {
787
- var appElement = jqLite ( '<div class="ng-app"></div>' ) [ 0 ] ;
788
- angularInit ( jqLite ( '<div></div>' ) . append ( appElement ) [ 0 ] , bootstrapSpy ) ;
789
- expect ( bootstrapSpy ) . toHaveBeenCalledOnceWith ( appElement , [ ] , jasmine . any ( Object ) ) ;
790
- } ) ;
791
-
792
-
793
761
it ( 'should bootstrap if the annotation is on the root element' , function ( ) {
794
- var appElement = jqLite ( '<div class=" ng-app"></div>' ) [ 0 ] ;
762
+ var appElement = jqLite ( '<div ng-app=" "></div>' ) [ 0 ] ;
795
763
angularInit ( appElement , bootstrapSpy ) ;
796
764
expect ( bootstrapSpy ) . toHaveBeenCalledOnceWith ( appElement , [ ] , jasmine . any ( Object ) ) ;
797
765
} ) ;
@@ -838,7 +806,7 @@ describe('angular', function() {
838
806
839
807
it ( 'should bootstrap in strict mode when ng-strict-di attribute is specified' , function ( ) {
840
808
bootstrapSpy = spyOn ( angular , 'bootstrap' ) . andCallThrough ( ) ;
841
- var appElement = jqLite ( '<div class=" ng-app" ng-strict-di></div>' ) ;
809
+ var appElement = jqLite ( '<div ng-app=" " ng-strict-di></div>' ) ;
842
810
angularInit ( jqLite ( '<div></div>' ) . append ( appElement [ 0 ] ) [ 0 ] , bootstrapSpy ) ;
843
811
expect ( bootstrapSpy ) . toHaveBeenCalledOnce ( ) ;
844
812
expect ( bootstrapSpy . mostRecentCall . args [ 2 ] . strictDi ) . toBe ( true ) ;
0 commit comments