'use strict'; describe('event directives', function() { var element; afterEach(function() { dealoc(element); }); describe('ngSubmit', function() { it('should get called on form submit', inject(function($rootScope, $compile) { element = $compile('
' + '' + '
')($rootScope); $rootScope.$digest(); expect($rootScope.submitted).not.toBeDefined(); 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'); })); }); });