Skip to content

Commit 3b317c5

Browse files
metawetaIgorMinar
authored andcommitted
test(ngBindHtml): prevent variable name leak
Add "var" so element is local instead of global Strict mode doesn't allow undeclared global vars, and these really should be local anyway.
1 parent e4cfb9d commit 3b317c5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/ngSanitize/directive/ngBindHtmlSpec.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1+
'use strict';
2+
3+
14
describe('ngBindHtml', function() {
25
beforeEach(module('ngSanitize'));
36

47
it('should set html', inject(function($rootScope, $compile) {
5-
element = $compile('<div ng-bind-html="html"></div>')($rootScope);
8+
var element = $compile('<div ng-bind-html="html"></div>')($rootScope);
69
$rootScope.html = '<div unknown>hello</div>';
710
$rootScope.$digest();
811
expect(angular.lowercase(element.html())).toEqual('<div>hello</div>');
912
}));
1013

1114

1215
it('should reset html when value is null or undefined', inject(function($compile, $rootScope) {
13-
element = $compile('<div ng-bind-html="html"></div>')($rootScope);
16+
var element = $compile('<div ng-bind-html="html"></div>')($rootScope);
1417

1518
angular.forEach([null, undefined, ''], function(val) {
1619
$rootScope.html = 'some val';

0 commit comments

Comments
 (0)