From b0d5f062e316370c7ac57cfd628d085015a8187d Mon Sep 17 00:00:00 2001 From: Wesley Cho Date: Thu, 23 May 2013 11:22:55 -0400 Subject: fix(ngSubmit): expose $event to ngSubmit callback --- test/ng/directive/ngEventDirsSpec.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') 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('
')($rootScope); + $rootScope.$digest(); + expect($rootScope.formSubmitted).not.toBeDefined(); + + browserTrigger(element.children()[0]); + expect($rootScope.formSubmitted).toEqual('foo'); + })); }); }); -- cgit v1.2.3