Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 45fe38b

Browse files
committed
fixup! feat($compile): add support for arbitrary property and event bindings
1 parent e1ce56e commit 45fe38b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test/ng/compileSpec.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -12411,9 +12411,9 @@ describe('$compile', function() {
1241112411
element = $compile('<img ng-prop-src="testUrl"></img>')($rootScope);
1241212412
// Some browsers complain if you try to write `javascript:` into an `img[src]`
1241312413
// So for the test use something different
12414-
$rootScope.testUrl = $sce.trustAsMediaUrl('someUntrustedThing:foo();');
12414+
$rootScope.testUrl = $sce.trustAsMediaUrl('someuntrustedthing:foo();');
1241512415
$rootScope.$digest();
12416-
expect(element.prop('src')).toEqual('someUntrustedThing:foo();');
12416+
expect(element.prop('src')).toEqual('someuntrustedthing:foo();');
1241712417
}));
1241812418

1241912419
it('should sanitize concatenated values even if they are trusted', inject(function($rootScope, $compile, $sce) {
@@ -12456,7 +12456,6 @@ describe('$compile', function() {
1245612456
});
1245712457
});
1245812458

12459-
1246012459
it('should use $$sanitizeUri on concatenated trusted values', function() {
1246112460
var $$sanitizeUri = jasmine.createSpy('$$sanitizeUri').and.returnValue('someSanitizedUrl');
1246212461
module(function($provide) {
@@ -12494,6 +12493,13 @@ describe('$compile', function() {
1249412493
describe('img[srcset] sanitization', function() {
1249512494
it('should not error if srcset is undefined', inject(function($compile, $rootScope) {
1249612495
element = $compile('<img ng-prop-srcset="testUrl"></img>')($rootScope);
12496+
// Set srcset to a value
12497+
$rootScope.testUrl = 'http://example.com/';
12498+
$rootScope.$digest();
12499+
expect(element.prop('srcset')).toBe('http://example.com/');
12500+
12501+
// Now set it to undefined
12502+
$rootScope.testUrl = '';
1249712503
$rootScope.$digest();
1249812504
expect(element.prop('srcset')).toBe('');
1249912505
}));
@@ -12631,7 +12637,7 @@ describe('$compile', function() {
1263112637
expect(element.prop('href')).toBe('javascript:doEvilStuff()');
1263212638
}));
1263312639

12634-
it('should not sanitize properties', inject(function($compile, $rootScope) {
12640+
it('should not sanitize properties other then those configured', inject(function($compile, $rootScope) {
1263512641
element = $compile('<a ng-prop-title="testUrl"></a>')($rootScope);
1263612642
$rootScope.testUrl = 'javascript:doEvilStuff()';
1263712643
$rootScope.$apply();

0 commit comments

Comments
 (0)