diff options
| author | Igor Minar | 2012-04-08 02:49:03 -0700 |
|---|---|---|
| committer | Igor Minar | 2012-04-09 09:52:28 -0700 |
| commit | 10daefc6f466a21d9418437666461c80cf24fcfe (patch) | |
| tree | 1d2e18314467229f3a2fd1fc95981a4c5704ff51 /test/ng/directive | |
| parent | dc7b764d4da500682799234b32b6bd44e73c5d41 (diff) | |
| download | angular.js-10daefc6f466a21d9418437666461c80cf24fcfe.tar.bz2 | |
fix(ngBindHtml): clear contents when model is falsy
Closes #864
Diffstat (limited to 'test/ng/directive')
| -rw-r--r-- | test/ng/directive/ngBindSpec.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ng/directive/ngBindSpec.js b/test/ng/directive/ngBindSpec.js index c83c8c85..ad4d30ff 100644 --- a/test/ng/directive/ngBindSpec.js +++ b/test/ng/directive/ngBindSpec.js @@ -82,6 +82,21 @@ describe('ng-bind-*', function() { $rootScope.$digest(); expect(lowercase(element.html())).toEqual('<div>hello</div>'); })); + + + it('should reset html when value is null or undefined', inject(function($compile, $rootScope) { + element = $compile('<div ng-bind-html="html"></div>')($rootScope); + + forEach([null, undefined, ''], function(val) { + $rootScope.html = 'some val'; + $rootScope.$digest(); + expect(lowercase(element.html())).toEqual('some val'); + + $rootScope.html = val; + $rootScope.$digest(); + expect(lowercase(element.html())).toEqual(''); + }); + })); }); |
