mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
26 lines
705 B
JavaScript
26 lines
705 B
JavaScript
'use strict';
|
|
|
|
describe('ng:click', function() {
|
|
var element;
|
|
|
|
afterEach(function() {
|
|
dealoc(element);
|
|
});
|
|
|
|
it('should get called on a click', inject(function($rootScope, $compile) {
|
|
element = $compile('<div ng:click="clicked = true"></div>')($rootScope);
|
|
$rootScope.$digest();
|
|
expect($rootScope.clicked).toBeFalsy();
|
|
|
|
browserTrigger(element, 'click');
|
|
expect($rootScope.clicked).toEqual(true);
|
|
}));
|
|
|
|
it('should pass event object', inject(function($rootScope, $compile) {
|
|
element = $compile('<div ng:click="event = $event"></div>')($rootScope);
|
|
$rootScope.$digest();
|
|
|
|
browserTrigger(element, 'click');
|
|
expect($rootScope.event).toBeDefined();
|
|
}));
|
|
});
|