Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
style(formSpec): fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Narretz committed Sep 4, 2015
1 parent c6110e8 commit aa11dfc
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions test/ng/directive/formSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,35 +660,36 @@ describe('form', function() {
expect(doc.find('div').hasClass('ng-pending')).toBe(false);
});

it('should leave the parent form invalid when deregister a removed input', function() {
doc = jqLite(
'<form name="parent">' +
'<div class="ng-form" name="child">' +
'<input ng-if="inputPresent" ng-model="modelA" name="inputA" required>' +
'<input ng-model="modelB" name="inputB" required>' +
'</div>' +
'</form>');
$compile(doc)(scope);
scope.inputPresent = true;
scope.$apply();

var parent = scope.parent,
child = scope.child,
inputA = child.inputA,
inputB = child.inputB;
it('should leave the parent form invalid when deregister a removed input', function() {
doc = jqLite(
'<form name="parent">' +
'<div class="ng-form" name="child">' +
'<input ng-if="inputPresent" ng-model="modelA" name="inputA" required>' +
'<input ng-model="modelB" name="inputB" required>' +
'</div>' +
'</form>');
$compile(doc)(scope);
scope.inputPresent = true;
scope.$apply();

expect(parent).toBeDefined();
expect(child).toBeDefined();
expect(parent.$error.required).toEqual([child]);
expect(child.$error.required).toEqual([inputB, inputA]);
var parent = scope.parent,
child = scope.child,
inputA = child.inputA,
inputB = child.inputB;

//remove child input
scope.inputPresent = false;
scope.$apply();
expect(parent).toBeDefined();
expect(child).toBeDefined();
expect(parent.$error.required).toEqual([child]);
expect(child.$error.required).toEqual([inputB, inputA]);

expect(parent.$error.required).toEqual([child]);
expect(child.$error.required).toEqual([inputB]);
});
//remove child input
scope.inputPresent = false;
scope.$apply();

expect(parent.$error.required).toEqual([child]);
expect(child.$error.required).toEqual([inputB]);
});


it('should ignore changes in manually removed child forms', function() {
Expand Down

0 comments on commit aa11dfc

Please sign in to comment.