From 3ab49538a414a36c97ed3735c2473eefcf7be073 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 13 Oct 2010 10:51:16 -0700 Subject: fixed issue where ng:bind would not reset value if expression returned undefined --- test/directivesSpec.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'test/directivesSpec.js') diff --git a/test/directivesSpec.js b/test/directivesSpec.js index d8f04b29..e65973dc 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -38,6 +38,16 @@ describe("directives", function(){ expect(element.text()).toEqual('misko'); }); + it('should set text to blank if undefined', function() { + var scope = compile('
'); + scope.a = 'misko'; + scope.$eval(); + expect(element.text()).toEqual('misko'); + scope.a = undefined; + scope.$eval(); + expect(element.text()).toEqual(''); + }); + it('should set html', function() { var scope = compile(''); scope.html = '