mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
29 lines
779 B
JavaScript
29 lines
779 B
JavaScript
'use strict';
|
|
|
|
describe('ngKeyup and ngKeydown directives', function() {
|
|
var element;
|
|
|
|
afterEach(function() {
|
|
dealoc(element);
|
|
});
|
|
|
|
it('should get called on a keyup', inject(function($rootScope, $compile) {
|
|
element = $compile('<input ng-keyup="touched = true">')($rootScope);
|
|
$rootScope.$digest();
|
|
expect($rootScope.touched).toBeFalsy();
|
|
|
|
browserTrigger(element, 'keyup');
|
|
expect($rootScope.touched).toEqual(true);
|
|
}));
|
|
|
|
it('should get called on a keydown', inject(function($rootScope, $compile) {
|
|
element = $compile('<input ng-keydown="touched = true">')($rootScope);
|
|
$rootScope.$digest();
|
|
expect($rootScope.touched).toBeFalsy();
|
|
|
|
browserTrigger(element, 'keydown');
|
|
expect($rootScope.touched).toEqual(true);
|
|
}));
|
|
|
|
});
|
|
|