mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-08 14:54:44 +00:00
fix(FormController): propagate dirty state to parent forms
This commit is contained in:
parent
a9be003fce
commit
04329151d2
2 changed files with 4 additions and 0 deletions
|
|
@ -117,6 +117,7 @@ function FormController(element, attrs) {
|
||||||
element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS);
|
element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS);
|
||||||
form.$dirty = true;
|
form.$dirty = true;
|
||||||
form.$pristine = false;
|
form.$pristine = false;
|
||||||
|
parentForm.$setDirty();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -284,6 +284,9 @@ describe('form', function() {
|
||||||
inputB.$setValidity('MyError', true);
|
inputB.$setValidity('MyError', true);
|
||||||
expect(parent.$error.MyError).toBe(false);
|
expect(parent.$error.MyError).toBe(false);
|
||||||
expect(child.$error.MyError).toBe(false);
|
expect(child.$error.MyError).toBe(false);
|
||||||
|
|
||||||
|
child.$setDirty();
|
||||||
|
expect(parent.$dirty).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue