From 01c5be4681e34cdc5f5c461b7a618fefe8038919 Mon Sep 17 00:00:00 2001 From: Brian Ford Date: Thu, 2 Jan 2014 14:48:03 -0800 Subject: fix(ngShow/ngHide, ngIf): functions with zero args should be truthy Previously, expressions that were a function with one or more arguments evaluated to true, but functions with zero arguments evaluated to false. This behavior seems both unintentional and undesirable. This patch makes a function truthy regardless of its number of arguments. Closes #5414 --- test/ng/directive/ngShowHideSpec.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/ng/directive/ngShowHideSpec.js') diff --git a/test/ng/directive/ngShowHideSpec.js b/test/ng/directive/ngShowHideSpec.js index 4a8e55da..30397c4c 100644 --- a/test/ng/directive/ngShowHideSpec.js +++ b/test/ng/directive/ngShowHideSpec.js @@ -20,6 +20,16 @@ describe('ngShow / ngHide', function() { })); + // https://github.com/angular/angular.js/issues/5414 + it('should show if the expression is a function with a no arguments', inject(function($rootScope, $compile) { + element = jqLite('
'); + element = $compile(element)($rootScope); + $rootScope.exp = function(){}; + $rootScope.$digest(); + expect(element).toBeShown(); + })); + + it('should make hidden element visible', inject(function($rootScope, $compile) { element = jqLite(''); element = $compile(element)($rootScope); -- cgit v1.2.3