From 823adb231995e917bc060bfa49453e2a96bac2b6 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 15 Mar 2012 14:08:49 -0700 Subject: fix(ngForm): alias name||ngForm form directive was requiring name attribute even when invoked as attribute, resulting in unnecessary duplication --- test/directive/formSpec.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/directive/formSpec.js b/test/directive/formSpec.js index ec16e19b..5c34b5ad 100644 --- a/test/directive/formSpec.js +++ b/test/directive/formSpec.js @@ -33,9 +33,9 @@ describe('form', function() { it('should remove the widget when element removed', function() { doc = $compile( - '
' + - '' + - '
')(scope); + '
' + + '' + + '
')(scope); var form = scope.myForm; control.$setValidity('required', false); @@ -48,6 +48,17 @@ describe('form', function() { }); + it('should use ng-form as form name', function() { + doc = $compile( + '
' + + '' + + '
')(scope); + + expect(scope.myForm).toBeDefined(); + expect(scope.myForm.alias).toBeDefined(); + }); + + it('should prevent form submission', function() { var startingUrl = '' + window.location; doc = jqLite('
'); @@ -89,8 +100,7 @@ describe('form', function() { it('should allow form name to be an expression', function() { doc = $compile('
')(scope); - expect(scope.obj).toBeDefined(); - expect(scope.obj.myForm).toBeTruthy(); + expect(scope['obj.myForm']).toBeTruthy(); }); -- cgit v1.2.3