From 2bb27d4998805fd89db25192f53d26d259ae615f Mon Sep 17 00:00:00 2001
From: Andreas Sander
Date: Tue, 16 Jul 2013 23:36:38 +0200
Subject: feat(directive): ng:focus, ng:blur
Added directives for focus and blur events.
Closes #1277
---
test/ng/directive/ngKeySpec.js | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
(limited to 'test/ng/directive')
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('')($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('')($rootScope);
+ $rootScope.$digest();
+ expect($rootScope.touched).toBeFalsy();
+
+ browserTrigger(element, 'blur');
+ expect($rootScope.touched).toEqual(true);
+ }));
+
});
--
cgit v1.2.3