mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-23 03:30:02 +08:00
fix(ngSubmit): expose $event to ngSubmit callback
This commit is contained in:
@@ -21,5 +21,22 @@ describe('event directives', function() {
|
||||
browserTrigger(element.children()[0]);
|
||||
expect($rootScope.submitted).toEqual(true);
|
||||
}));
|
||||
|
||||
it('should expose event on form submit', inject(function($rootScope, $compile) {
|
||||
$rootScope.formSubmission = function(e) {
|
||||
if (e) {
|
||||
$rootScope.formSubmitted = 'foo';
|
||||
}
|
||||
};
|
||||
|
||||
element = $compile('<form action="" ng-submit="formSubmission($event)">' +
|
||||
'<input type="submit"/>' +
|
||||
'</form>')($rootScope);
|
||||
$rootScope.$digest();
|
||||
expect($rootScope.formSubmitted).not.toBeDefined();
|
||||
|
||||
browserTrigger(element.children()[0]);
|
||||
expect($rootScope.formSubmitted).toEqual('foo');
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user