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 test indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonzalo Ruiz de Villa committed Nov 22, 2014
1 parent e9b9421 commit 119ace4
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions test/ng/directive/formSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,35 +495,35 @@ describe('form', function() {
expect(doc.find('div').hasClass('ng-valid-required')).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();
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;
var parent = scope.parent,
child = scope.child,
inputA = child.inputA,
inputB = child.inputB;

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

//remove child input
scope.inputPresent = false;
scope.$apply();
//remove child input
scope.inputPresent = false;
scope.$apply();

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

it('should chain nested forms in repeater', function() {
doc = jqLite(
Expand Down

0 comments on commit 119ace4

Please sign in to comment.