diff options
| author | Samuel Santos | 2013-05-07 17:45:28 +0100 |
|---|---|---|
| committer | Pete Bacon Darwin | 2013-05-14 21:29:21 +0100 |
| commit | d551d72924f7c43a043e4760ff05d7389e310f99 (patch) | |
| tree | 1c7f46aee3b08d439921b32e4469193eefb19f25 /test/ng/directive/ngSrcsetSpec.js | |
| parent | 629fb37351ce5778a40a8bc8cd7c1385b382ce75 (diff) | |
| download | angular.js-d551d72924f7c43a043e4760ff05d7389e310f99.tar.bz2 | |
feat(ngSrcset): add new ngSrcset directive
In line with ngSrc and ngHref, this new directive ensures that the
`srcset` HTML5 attribute does not include a pre-interpolated string.
Without it the browser will fetch from the URL with the literal text
`{{hash}}` until AngularJS replaces the expression inside `{{hash}}`.
Closes #2601
Diffstat (limited to 'test/ng/directive/ngSrcsetSpec.js')
| -rw-r--r-- | test/ng/directive/ngSrcsetSpec.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ng/directive/ngSrcsetSpec.js b/test/ng/directive/ngSrcsetSpec.js new file mode 100644 index 00000000..8fccb00a --- /dev/null +++ b/test/ng/directive/ngSrcsetSpec.js @@ -0,0 +1,16 @@ +'use strict'; + +describe('ngSrcset', function() { + var element; + + afterEach(function() { + dealoc(element); + }); + + it('should not result empty string in img srcset', inject(function($rootScope, $compile) { + $rootScope.image = {}; + element = $compile('<img ng-srcset="{{image.url}} 2x">')($rootScope); + $rootScope.$digest(); + expect(element.attr('srcset')).toEqual(' 2x'); + })); +}); |
