mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
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
16 lines
400 B
JavaScript
16 lines
400 B
JavaScript
'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');
|
|
}));
|
|
});
|