@@ -347,6 +347,57 @@ describe('angular', function() {
347
347
} ) ;
348
348
} ) ;
349
349
350
+ describe ( 'jq' , function ( ) {
351
+
352
+ var element ;
353
+
354
+ beforeEach ( function ( ) {
355
+ element = document . createElement ( 'html' ) ;
356
+ } ) ;
357
+
358
+ afterEach ( function ( ) {
359
+ jq . name_ = undefined ;
360
+ delete jq . name_ ;
361
+ } ) ;
362
+
363
+ it ( 'should return undefined when jq is not set (the default)' , function ( ) {
364
+ expect ( jq ( ) ) . toBe ( undefined ) ;
365
+ } ) ;
366
+
367
+ it ( 'should return empty string when jq is enabled manually via [ng-jq] with empty string' , function ( ) {
368
+ element . setAttribute ( 'ng-jq' , '' ) ;
369
+ spyOn ( document , 'querySelector' ) . andCallFake ( function ( selector ) {
370
+ if ( selector == '[ng-jq]' ) return element ;
371
+ } ) ;
372
+ expect ( jq ( ) ) . toBe ( '' ) ;
373
+ } ) ;
374
+
375
+ it ( 'should return empty string when jq is enabled manually via [data-ng-jq] with empty string' , function ( ) {
376
+ element . setAttribute ( 'data-ng-jq' , '' ) ;
377
+ spyOn ( document , 'querySelector' ) . andCallFake ( function ( selector ) {
378
+ if ( selector == '[data-ng-jq]' ) return element ;
379
+ } ) ;
380
+ expect ( jq ( ) ) . toBe ( '' ) ;
381
+ expect ( document . querySelector ) . toHaveBeenCalledWith ( '[data-ng-jq]' ) ;
382
+ } ) ;
383
+
384
+ it ( 'should return "jquery" when jq is enabled manually via [ng-jq] with value "jquery"' , function ( ) {
385
+ element . setAttribute ( 'ng-jq' , 'jquery' ) ;
386
+ spyOn ( document , 'querySelector' ) . andCallFake ( function ( selector ) {
387
+ if ( selector == '[ng-jq]' ) return element ;
388
+ } ) ;
389
+ expect ( jq ( ) ) . toBe ( 'jquery' ) ;
390
+ } ) ;
391
+
392
+ it ( 'should return "jquery" when jq is enabled manually via [data-ng-jq] with value "jquery"' , function ( ) {
393
+ element . setAttribute ( 'data-ng-jq' , 'jquery' ) ;
394
+ spyOn ( document , 'querySelector' ) . andCallFake ( function ( selector ) {
395
+ if ( selector == '[data-ng-jq]' ) return element ;
396
+ } ) ;
397
+ expect ( jq ( ) ) . toBe ( 'jquery' ) ;
398
+ expect ( document . querySelector ) . toHaveBeenCalledWith ( '[data-ng-jq]' ) ;
399
+ } ) ;
400
+ } ) ;
350
401
351
402
describe ( 'parseKeyValue' , function ( ) {
352
403
it ( 'should parse a string into key-value pairs' , function ( ) {
0 commit comments