diff options
| author | Andreas Sander | 2013-07-16 23:36:38 +0200 |
|---|---|---|
| committer | Pawel Kozlowski | 2013-07-18 19:24:42 +0200 |
| commit | 2bb27d4998805fd89db25192f53d26d259ae615f (patch) | |
| tree | 12bf70d4909ee3b2956f5770733cf5b378d0a099 /test/ng/directive/ngKeySpec.js | |
| parent | 1a8d83d6608f7c29116e4dc9dd565df21a4ae045 (diff) | |
| download | angular.js-2bb27d4998805fd89db25192f53d26d259ae615f.tar.bz2 | |
feat(directive): ng:focus, ng:blur
Added directives for focus and blur events.
Closes #1277
Diffstat (limited to 'test/ng/directive/ngKeySpec.js')
| -rw-r--r-- | test/ng/directive/ngKeySpec.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ng/directive/ngKeySpec.js b/test/ng/directive/ngKeySpec.js index c7b989a4..ef5addd5 100644 --- a/test/ng/directive/ngKeySpec.js +++ b/test/ng/directive/ngKeySpec.js @@ -34,5 +34,23 @@ describe('ngKeyup and ngKeydown directives', function() { expect($rootScope.touched).toEqual(true); })); + it('should get called on focus', inject(function($rootScope, $compile) { + element = $compile('<input ng-focus="touched = true">')($rootScope); + $rootScope.$digest(); + expect($rootScope.touched).toBeFalsy(); + + browserTrigger(element, 'focus'); + expect($rootScope.touched).toEqual(true); + })); + + it('should get called on blur', inject(function($rootScope, $compile) { + element = $compile('<input ng-blur="touched = true">')($rootScope); + $rootScope.$digest(); + expect($rootScope.touched).toBeFalsy(); + + browserTrigger(element, 'blur'); + expect($rootScope.touched).toEqual(true); + })); + }); |
