diff options
Diffstat (limited to 'test/directive/formSpec.js')
| -rw-r--r-- | test/directive/formSpec.js | 20 |
1 files changed, 15 insertions, 5 deletions
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( - '<form name="myForm">' + - '<input type="text" name="alias" ng-model="value" store-model-ctrl/>' + - '</form>')(scope); + '<form name="myForm">' + + '<input type="text" name="alias" ng-model="value" store-model-ctrl/>' + + '</form>')(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( + '<div ng-form="myForm">' + + '<input type="text" name="alias" ng-model="value"/>' + + '</div>')(scope); + + expect(scope.myForm).toBeDefined(); + expect(scope.myForm.alias).toBeDefined(); + }); + + it('should prevent form submission', function() { var startingUrl = '' + window.location; doc = jqLite('<form name="myForm"><input type="submit" value="submit" />'); @@ -89,8 +100,7 @@ describe('form', function() { it('should allow form name to be an expression', function() { doc = $compile('<form name="obj.myForm"></form>')(scope); - expect(scope.obj).toBeDefined(); - expect(scope.obj.myForm).toBeTruthy(); + expect(scope['obj.myForm']).toBeTruthy(); }); |
