diff options
| author | Wesley Cho | 2013-05-23 11:22:55 -0400 | 
|---|---|---|
| committer | Igor Minar | 2013-07-11 17:27:36 -0700 | 
| commit | b0d5f062e316370c7ac57cfd628d085015a8187d (patch) | |
| tree | eb3391aafa990e0ea04ea42804f7b97111fb8ad2 /test/ng | |
| parent | 2c0753225a506185bf8b09b344e7615957009f02 (diff) | |
| download | angular.js-b0d5f062e316370c7ac57cfd628d085015a8187d.tar.bz2 | |
fix(ngSubmit): expose $event to ngSubmit callback
Diffstat (limited to 'test/ng')
| -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'); +    }));    });  });  | 
