mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
feat(ngModelController): add $setDirty method
- extract existing functionality to public method: $setDirty - add tests to corresponding changes - refactor code to use extracted method Closes #10038 Closes #10049
This commit is contained in:
committed by
Martin Staffa
parent
bb16759f0b
commit
e8941c0fe5
@@ -139,6 +139,23 @@ describe('NgModelController', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('setDirty', function() {
|
||||
|
||||
it('should set control to its dirty state', function() {
|
||||
expect(ctrl.$pristine).toBe(true);
|
||||
expect(ctrl.$dirty).toBe(false);
|
||||
|
||||
ctrl.$setDirty();
|
||||
expect(ctrl.$pristine).toBe(false);
|
||||
expect(ctrl.$dirty).toBe(true);
|
||||
});
|
||||
|
||||
it('should set parent form to its dirty state', function() {
|
||||
ctrl.$setDirty();
|
||||
expect(parentFormCtrl.$setDirty).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('setUntouched', function() {
|
||||
|
||||
it('should set control to its untouched state', function() {
|
||||
|
||||
Reference in New Issue
Block a user