@@ -362,6 +362,46 @@ describe('ngInclude', function() {
362
362
} ) ) ;
363
363
364
364
365
+ it ( 'should construct SVG template elements with correct namespace' , function ( ) {
366
+ if ( ! window . SVGRectElement ) return ;
367
+ module ( function ( $compileProvider ) {
368
+ $compileProvider . directive ( 'test' , valueFn ( {
369
+ templateNamespace : 'svg' ,
370
+ templateUrl : 'my-rect.html' ,
371
+ replace : true
372
+ } ) ) ;
373
+ } ) ;
374
+ inject ( function ( $compile , $rootScope , $httpBackend ) {
375
+ $httpBackend . expectGET ( 'my-rect.html' ) . respond ( '<g ng-include="\'include.svg\'"></g>' ) ;
376
+ $httpBackend . expectGET ( 'include.svg' ) . respond ( '<rect></rect><rect></rect>' ) ;
377
+ element = $compile ( '<svg><test></test></svg>' ) ( $rootScope ) ;
378
+ $httpBackend . flush ( ) ;
379
+ var child = element . find ( 'rect' ) ;
380
+ expect ( child . length ) . toBe ( 2 ) ;
381
+ expect ( child [ 0 ] instanceof SVGRectElement ) . toBe ( true ) ;
382
+ } ) ;
383
+ } ) ;
384
+
385
+
386
+ it ( 'should compile only the template content of an SVG template' , function ( ) {
387
+ if ( ! window . SVGRectElement ) return ;
388
+ module ( function ( $compileProvider ) {
389
+ $compileProvider . directive ( 'test' , valueFn ( {
390
+ templateNamespace : 'svg' ,
391
+ templateUrl : 'my-rect.html' ,
392
+ replace : true
393
+ } ) ) ;
394
+ } ) ;
395
+ inject ( function ( $compile , $rootScope , $httpBackend ) {
396
+ $httpBackend . expectGET ( 'my-rect.html' ) . respond ( '<g ng-include="\'include.svg\'"><a></a></g>' ) ;
397
+ $httpBackend . expectGET ( 'include.svg' ) . respond ( '<rect></rect><rect></rect>' ) ;
398
+ element = $compile ( '<svg><test></test></svg>' ) ( $rootScope ) ;
399
+ $httpBackend . flush ( ) ;
400
+ expect ( element . find ( 'a' ) . length ) . toBe ( 0 ) ;
401
+ } ) ;
402
+ } ) ;
403
+
404
+
365
405
describe ( 'autoscroll' , function ( ) {
366
406
var autoScrollSpy ;
367
407
0 commit comments