@@ -12416,30 +12416,6 @@ describe('$compile', function() {
12416
12416
expect ( element . prop ( 'src' ) ) . toEqual ( 'someuntrustedthing:foo();' ) ;
12417
12417
} ) ) ;
12418
12418
12419
- it('should sanitize concatenated values even if they are trusted', inject(function($rootScope, $compile, $sce) {
12420
- element = $compile('<img ng-prop-src="testUrl + \'ponies\'"></img>')($rootScope);
12421
- $rootScope.testUrl = $sce.trustAsUrl('untrusted:foo();');
12422
- $rootScope.$digest();
12423
- expect(element.prop('src')).toEqual('unsafe:untrusted:foo();ponies');
12424
-
12425
- element = $compile('<img ng-prop-src="\'http://\' + testUrl2"></img>')($rootScope);
12426
- $rootScope.testUrl2 = $sce.trustAsUrl('xyz;');
12427
- $rootScope.$digest();
12428
- expect(element.prop('src')).toEqual('http://xyz%3B/');
12429
-
12430
- element = $compile('<img ng-prop-src="testUrl3 + testUrl3"></img>')($rootScope);
12431
- $rootScope.testUrl3 = $sce.trustAsUrl('untrusted:foo();');
12432
- $rootScope.$digest();
12433
- expect(element.prop('src')).toEqual('unsafe:untrusted:foo();untrusted:foo();');
12434
- }));
12435
-
12436
- it('should not sanitize other properties', inject(function($compile, $rootScope) {
12437
- element = $compile('<img ng-prop-title="testUrl"></img>')($rootScope);
12438
- $rootScope.testUrl = 'javascript:doEvilStuff()';
12439
- $rootScope.$apply();
12440
- expect(element.prop('title')).toBe('javascript:doEvilStuff()');
12441
- }));
12442
-
12443
12419
it ( 'should use $$sanitizeUri' , function ( ) {
12444
12420
var $$sanitizeUri = jasmine . createSpy ( '$$sanitizeUri' ) ;
12445
12421
module ( function ( $provide ) {
@@ -12456,24 +12432,6 @@ describe('$compile', function() {
12456
12432
} ) ;
12457
12433
} ) ;
12458
12434
12459
- it('should use $$sanitizeUri on concatenated trusted values', function() {
12460
- var $$sanitizeUri = jasmine.createSpy('$$sanitizeUri').and.returnValue('someSanitizedUrl');
12461
- module(function($provide) {
12462
- $provide.value('$$sanitizeUri', $$sanitizeUri);
12463
- });
12464
- inject(function($compile, $rootScope, $sce) {
12465
- element = $compile('<img ng-prop-src="testUrl + \'ponies\'"></img>')($rootScope);
12466
- $rootScope.testUrl = $sce.trustAsUrl('javascript:foo();');
12467
- $rootScope.$digest();
12468
- expect(element.prop('src')).toMatch(/^http:\/\/.*\/someSanitizedUrl$/);
12469
-
12470
- element = $compile('<img ng-prop-src="\'http://\' + testUrl"></img>')($rootScope);
12471
- $rootScope.testUrl = $sce.trustAsUrl('xyz');
12472
- $rootScope.$digest();
12473
- expect(element.prop('src')).toMatch(/^http:\/\/.*\/someSanitizedUrl$/);
12474
- });
12475
- });
12476
-
12477
12435
it ( 'should not use $$sanitizeUri with trusted values' , function ( ) {
12478
12436
var $$sanitizeUri = jasmine . createSpy ( '$$sanitizeUri' ) . and . throwError ( 'Should not have been called' ) ;
12479
12437
module ( function ( $provide ) {
@@ -12558,7 +12516,7 @@ describe('$compile', function() {
12558
12516
} ) ;
12559
12517
12560
12518
it ( 'should sanitize all uris in srcset' , inject ( function ( $rootScope , $compile ) {
12561
- element = $compile('<img srcset="{{ testUrl}} "></img>')($rootScope);
12519
+ element = $compile ( '<img ng-prop- srcset="testUrl"></img>' ) ( $rootScope ) ;
12562
12520
var testSet = {
12563
12521
'http://example.com/image.png' :'http://example.com/image.png' ,
12564
12522
' http://example.com/image.png' :'http://example.com/image.png' ,
0 commit comments