aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/directive/ngEventDirsSpec.js
diff options
context:
space:
mode:
authorWesley Cho2013-05-23 11:22:55 -0400
committerIgor Minar2013-07-11 17:24:30 -0700
commit3371fc254a9698eae35bb6f8f1ee9c434ae761e2 (patch)
treeeff3ae4ac470ce86986eecd0c8a5d7b514f345f2 /test/ng/directive/ngEventDirsSpec.js
parent09a1e7af129880cab89a2f709f22a7286f52371e (diff)
downloadangular.js-3371fc254a9698eae35bb6f8f1ee9c434ae761e2.tar.bz2
fix(ngSubmit): expose $event to ngSubmit callback
Diffstat (limited to 'test/ng/directive/ngEventDirsSpec.js')
-rw-r--r--test/ng/directive/ngEventDirsSpec.js17
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');
+ }));
});
});