diff options
| author | Brian Ford | 2014-01-02 14:48:03 -0800 |
|---|---|---|
| committer | Brian Ford | 2014-01-02 22:59:43 -0800 |
| commit | 01c5be4681e34cdc5f5c461b7a618fefe8038919 (patch) | |
| tree | 0d96eb38e9df874ea9553d6caacd1275e8882855 /test | |
| parent | fd9a03e147aac7e952c6dda1f381fd4662276ba2 (diff) | |
| download | angular.js-01c5be4681e34cdc5f5c461b7a618fefe8038919.tar.bz2 | |
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
Diffstat (limited to 'test')
| -rw-r--r-- | test/ng/directive/ngShowHideSpec.js | 10 |
1 files changed, 10 insertions, 0 deletions
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('<div ng-show="exp"></div>'); + element = $compile(element)($rootScope); + $rootScope.exp = function(){}; + $rootScope.$digest(); + expect(element).toBeShown(); + })); + + it('should make hidden element visible', inject(function($rootScope, $compile) { element = jqLite('<div class="ng-hide" ng-show="exp"></div>'); element = $compile(element)($rootScope); |
