diff options
| author | Caitlin Potter | 2014-01-20 20:59:21 -0500 | 
|---|---|---|
| committer | Caitlin Potter | 2014-02-21 17:56:48 -0500 | 
| commit | 2bce71e9dc10c8588f9eb599a0cd2e831440fc48 (patch) | |
| tree | 91d711cbef54eb8a642e14b70a573b185cadc1a7 /test | |
| parent | c8e03e34b27a8449d8e1bfe0e3801d6a67ae2c49 (diff) | |
| download | angular.js-2bce71e9dc10c8588f9eb599a0cd2e831440fc48.tar.bz2 | |
feat(ngHref): bind ng-href to xlink:href for SVGAElement
This change makes the ngHref directive useful for SVGAElements by having it bind
to the xlink:href attribute rather than the href attribute.
Closes #5904
Diffstat (limited to 'test')
| -rw-r--r-- | test/ng/directive/booleanAttrsSpec.js | 24 | 
1 files changed, 24 insertions, 0 deletions
| diff --git a/test/ng/directive/booleanAttrsSpec.js b/test/ng/directive/booleanAttrsSpec.js index 83bc75e5..2d800f5b 100644 --- a/test/ng/directive/booleanAttrsSpec.js +++ b/test/ng/directive/booleanAttrsSpec.js @@ -251,4 +251,28 @@ describe('ngHref', function() {      $rootScope.$digest();      expect(element.attr('href')).toEqual('http://server');    })); + +  if (isDefined(window.SVGElement)) { +    describe('SVGAElement', function() { +      it('should interpolate the expression and bind to xlink:href', inject(function($compile, $rootScope) { +        element = $compile('<svg><a ng-href="some/{{id}}"></a></svg>')($rootScope); +        var child = element.children('a'); +        $rootScope.$digest(); +        expect(child.attr('xlink:href')).toEqual('some/'); + +        $rootScope.$apply(function() { +          $rootScope.id = 1; +        }); +        expect(child.attr('xlink:href')).toEqual('some/1'); +      })); + + +      it('should bind xlink:href even if no interpolation', inject(function($rootScope, $compile) { +        element = $compile('<svg><a ng-href="http://server"></a></svg>')($rootScope); +        var child = element.children('a'); +        $rootScope.$digest(); +        expect(child.attr('xlink:href')).toEqual('http://server'); +      })); +    }); +  }  }); | 
