diff options
| author | Pawel Kozlowski | 2012-07-07 19:02:04 +0200 |
|---|---|---|
| committer | Igor Minar | 2012-11-26 16:44:34 +0100 |
| commit | 733a97adf87bf8f7ec6be22b37c4676cf7b5fc2b (patch) | |
| tree | 99422e0e402fe4b4340552f8f80a4feb3ac861f0 /test/ng/directive/inputSpec.js | |
| parent | 96ed9ff59a454486c88bdf92ad9d28ab8864b85e (diff) | |
| download | angular.js-733a97adf87bf8f7ec6be22b37c4676cf7b5fc2b.tar.bz2 | |
feat(form): add ability to reset a form to pristine state
Retting a form to pristine state will cause all of the nested
form and form controls to be recursively reset as well.
Closes #856
Diffstat (limited to 'test/ng/directive/inputSpec.js')
| -rw-r--r-- | test/ng/directive/inputSpec.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js index 01669b18..4dcb79a3 100644 --- a/test/ng/directive/inputSpec.js +++ b/test/ng/directive/inputSpec.js @@ -117,6 +117,18 @@ describe('NgModelController', function() { }); }); + describe('setPristine', function() { + + it('should set control to its pristine state', function() { + ctrl.$setViewValue('edit'); + expect(ctrl.$dirty).toBe(true); + expect(ctrl.$pristine).toBe(false); + + ctrl.$setPristine(); + expect(ctrl.$dirty).toBe(false); + expect(ctrl.$pristine).toBe(true); + }); + }); describe('view -> model', function() { |
