aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/directive
diff options
context:
space:
mode:
Diffstat (limited to 'test/ng/directive')
-rw-r--r--test/ng/directive/ngKeySpec.js18
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);
+ }));
+
});