diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/ng/directive/ngEventDirsSpec.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ng/directive/ngEventDirsSpec.js b/test/ng/directive/ngEventDirsSpec.js index 4aa09fc5..5b73c2dd 100644 --- a/test/ng/directive/ngEventDirsSpec.js +++ b/test/ng/directive/ngEventDirsSpec.js @@ -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'); + })); }); }); |
