@@ -616,7 +616,7 @@ describe('angular', function() {
616
616
617
617
618
618
describe ( 'jq' , function ( ) {
619
- var element , fakeQuery ;
619
+ var element ;
620
620
621
621
beforeEach ( function ( ) {
622
622
element = document . createElement ( 'html' ) ;
@@ -648,22 +648,59 @@ describe('angular', function() {
648
648
expect ( document . querySelector ) . toHaveBeenCalledWith ( '[data-ng-jq]' ) ;
649
649
} ) ;
650
650
651
- it ( 'should return "jquery" when jq is enabled manually via [ng-jq] with value "jquery"' , function ( ) {
651
+ it ( 'should return empty string when jq is enabled manually via [x-ng-jq] with empty string' , function ( ) {
652
+ element . setAttribute ( 'x-ng-jq' , '' ) ;
653
+ spyOn ( document , 'querySelector' ) . andCallFake ( function ( selector ) {
654
+ if ( selector == '[x-ng-jq]' ) return element ;
655
+ } ) ;
656
+ expect ( jq ( ) ) . toBe ( '' ) ;
657
+ expect ( document . querySelector ) . toHaveBeenCalledWith ( '[x-ng-jq]' ) ;
658
+ } ) ;
659
+
660
+ it ( 'should return empty string when jq is enabled manually via [ng:jq] with empty string' , function ( ) {
661
+ element . setAttribute ( 'ng:jq' , '' ) ;
662
+ spyOn ( document , 'querySelector' ) . andCallFake ( function ( selector ) {
663
+ if ( selector == '[ng\\:jq]' ) return element ;
664
+ } ) ;
665
+ expect ( jq ( ) ) . toBe ( '' ) ;
666
+ expect ( document . querySelector ) . toHaveBeenCalledWith ( '[ng\\:jq]' ) ;
667
+ } ) ;
668
+
669
+ it ( 'should return "jquery" when jq is enabled manually via [ng-jq] with value "jQuery"' , function ( ) {
652
670
element . setAttribute ( 'ng-jq' , 'jQuery' ) ;
653
671
spyOn ( document , 'querySelector' ) . andCallFake ( function ( selector ) {
654
672
if ( selector == '[ng-jq]' ) return element ;
655
673
} ) ;
656
674
expect ( jq ( ) ) . toBe ( 'jQuery' ) ;
675
+ expect ( document . querySelector ) . toHaveBeenCalledWith ( '[ng-jq]' ) ;
657
676
} ) ;
658
677
659
- it ( 'should return "jquery" when jq is enabled manually via [data-ng-jq] with value "jquery "' , function ( ) {
678
+ it ( 'should return "jquery" when jq is enabled manually via [data-ng-jq] with value "jQuery "' , function ( ) {
660
679
element . setAttribute ( 'data-ng-jq' , 'jQuery' ) ;
661
680
spyOn ( document , 'querySelector' ) . andCallFake ( function ( selector ) {
662
681
if ( selector == '[data-ng-jq]' ) return element ;
663
682
} ) ;
664
683
expect ( jq ( ) ) . toBe ( 'jQuery' ) ;
665
684
expect ( document . querySelector ) . toHaveBeenCalledWith ( '[data-ng-jq]' ) ;
666
685
} ) ;
686
+
687
+ it ( 'should return "jquery" when jq is enabled manually via [x-ng-jq] with value "jQuery"' , function ( ) {
688
+ element . setAttribute ( 'x-ng-jq' , 'jQuery' ) ;
689
+ spyOn ( document , 'querySelector' ) . andCallFake ( function ( selector ) {
690
+ if ( selector == '[x-ng-jq]' ) return element ;
691
+ } ) ;
692
+ expect ( jq ( ) ) . toBe ( 'jQuery' ) ;
693
+ expect ( document . querySelector ) . toHaveBeenCalledWith ( '[x-ng-jq]' ) ;
694
+ } ) ;
695
+
696
+ it ( 'should return "jquery" when jq is enabled manually via [ng:jq] with value "jQuery"' , function ( ) {
697
+ element . setAttribute ( 'ng:jq' , 'jQuery' ) ;
698
+ spyOn ( document , 'querySelector' ) . andCallFake ( function ( selector ) {
699
+ if ( selector == '[ng\\:jq]' ) return element ;
700
+ } ) ;
701
+ expect ( jq ( ) ) . toBe ( 'jQuery' ) ;
702
+ expect ( document . querySelector ) . toHaveBeenCalledWith ( '[ng\\:jq]' ) ;
703
+ } ) ;
667
704
} ) ;
668
705
669
706
0 commit comments