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

Commit 8e65bdd

Browse files
committed
fixup! feat($compile): add support for arbitrary property and event bindings
1 parent a93ee19 commit 8e65bdd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/ng/compileSpec.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12962,6 +12962,27 @@ describe('$compile', function() {
1296212962
});
1296312963

1296412964
});
12965+
12966+
describe('*[style]', function() {
12967+
it('should NOT set style for untrusted values', inject(function($rootScope, $compile) {
12968+
element = $compile('<div ng-prop-style="style"></div>')($rootScope);
12969+
$rootScope.style = 'background: red';
12970+
expect(function() { $rootScope.$digest(); }).toThrow();
12971+
}));
12972+
12973+
it('should NOT set style for wrongly typed values', inject(function($rootScope, $compile, $sce) {
12974+
element = $compile('<div ng-prop-style="style"></div>')($rootScope);
12975+
$rootScope.style = $sce.trustAsHtml('background: red');
12976+
expect(function() { $rootScope.$digest(); }).toThrow();
12977+
}));
12978+
12979+
it('should set style for trusted values', inject(function($rootScope, $compile, $sce) {
12980+
element = $compile('<div ng-prop-style="style"></div>')($rootScope);
12981+
$rootScope.style = $sce.trustAsCss('background: red');
12982+
$rootScope.$digest();
12983+
expect(lowercase(element.css('background-color'))).toEqual('red');
12984+
}));
12985+
});
1296512986
});
1296612987

1296712988
describe('addPropertySecurityContext', function() {

0 commit comments

Comments
 (0)