mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-21 01:57:06 +08:00
feat(directive): ng:focus, ng:blur
Added directives for focus and blur events. Closes #1277
This commit is contained in:
committed by
Pawel Kozlowski
parent
1a8d83d660
commit
2bb27d4998
@@ -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);
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user