@@ -660,35 +660,36 @@ describe('form', function() {
660660 expect ( doc . find ( 'div' ) . hasClass ( 'ng-pending' ) ) . toBe ( false ) ;
661661 } ) ;
662662
663- it ( 'should leave the parent form invalid when deregister a removed input' , function ( ) {
664- doc = jqLite (
665- '<form name="parent">' +
666- '<div class="ng-form" name="child">' +
667- '<input ng-if="inputPresent" ng-model="modelA" name="inputA" required>' +
668- '<input ng-model="modelB" name="inputB" required>' +
669- '</div>' +
670- '</form>' ) ;
671- $compile ( doc ) ( scope ) ;
672- scope . inputPresent = true ;
673- scope . $apply ( ) ;
674663
675- var parent = scope . parent ,
676- child = scope . child ,
677- inputA = child . inputA ,
678- inputB = child . inputB ;
664+ it ( 'should leave the parent form invalid when deregister a removed input' , function ( ) {
665+ doc = jqLite (
666+ '<form name="parent">' +
667+ '<div class="ng-form" name="child">' +
668+ '<input ng-if="inputPresent" ng-model="modelA" name="inputA" required>' +
669+ '<input ng-model="modelB" name="inputB" required>' +
670+ '</div>' +
671+ '</form>' ) ;
672+ $compile ( doc ) ( scope ) ;
673+ scope . inputPresent = true ;
674+ scope . $apply ( ) ;
679675
680- expect ( parent ) . toBeDefined ( ) ;
681- expect ( child ) . toBeDefined ( ) ;
682- expect ( parent . $error . required ) . toEqual ( [ child ] ) ;
683- expect ( child . $error . required ) . toEqual ( [ inputB , inputA ] ) ;
676+ var parent = scope . parent ,
677+ child = scope . child ,
678+ inputA = child . inputA ,
679+ inputB = child . inputB ;
684680
685- //remove child input
686- scope . inputPresent = false ;
687- scope . $apply ( ) ;
681+ expect ( parent ) . toBeDefined ( ) ;
682+ expect ( child ) . toBeDefined ( ) ;
683+ expect ( parent . $error . required ) . toEqual ( [ child ] ) ;
684+ expect ( child . $error . required ) . toEqual ( [ inputB , inputA ] ) ;
688685
689- expect ( parent . $error . required ) . toEqual ( [ child ] ) ;
690- expect ( child . $error . required ) . toEqual ( [ inputB ] ) ;
691- } ) ;
686+ //remove child input
687+ scope . inputPresent = false ;
688+ scope . $apply ( ) ;
689+
690+ expect ( parent . $error . required ) . toEqual ( [ child ] ) ;
691+ expect ( child . $error . required ) . toEqual ( [ inputB ] ) ;
692+ } ) ;
692693
693694
694695 it ( 'should ignore changes in manually removed child forms' , function ( ) {
0 commit comments