From 10daefc6f466a21d9418437666461c80cf24fcfe Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Sun, 8 Apr 2012 02:49:03 -0700 Subject: fix(ngBindHtml): clear contents when model is falsy Closes #864 --- test/ng/directive/ngBindSpec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/ng/directive/ngBindSpec.js') 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('
hello
'); })); + + + it('should reset html when value is null or undefined', inject(function($compile, $rootScope) { + element = $compile('
')($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(''); + }); + })); }); -- cgit v1.2.3