mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
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.
This commit is contained in:
parent
e4cfb9d938
commit
3b317c5dcb
1 changed files with 5 additions and 2 deletions
|
|
@ -1,8 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
|
||||
describe('ngBindHtml', function() {
|
||||
beforeEach(module('ngSanitize'));
|
||||
|
||||
it('should set html', inject(function($rootScope, $compile) {
|
||||
element = $compile('<div ng-bind-html="html"></div>')($rootScope);
|
||||
var element = $compile('<div ng-bind-html="html"></div>')($rootScope);
|
||||
$rootScope.html = '<div unknown>hello</div>';
|
||||
$rootScope.$digest();
|
||||
expect(angular.lowercase(element.html())).toEqual('<div>hello</div>');
|
||||
|
|
@ -10,7 +13,7 @@ describe('ngBindHtml', function() {
|
|||
|
||||
|
||||
it('should reset html when value is null or undefined', inject(function($compile, $rootScope) {
|
||||
element = $compile('<div ng-bind-html="html"></div>')($rootScope);
|
||||
var element = $compile('<div ng-bind-html="html"></div>')($rootScope);
|
||||
|
||||
angular.forEach([null, undefined, ''], function(val) {
|
||||
$rootScope.html = 'some val';
|
||||
|
|
|
|||
Loading…
Reference in a new issue