aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/directive/inputSpec.js
diff options
context:
space:
mode:
authorPawel Kozlowski2012-07-07 19:02:04 +0200
committerIgor Minar2012-11-26 16:44:34 +0100
commit733a97adf87bf8f7ec6be22b37c4676cf7b5fc2b (patch)
tree99422e0e402fe4b4340552f8f80a4feb3ac861f0 /test/ng/directive/inputSpec.js
parent96ed9ff59a454486c88bdf92ad9d28ab8864b85e (diff)
downloadangular.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.js12
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() {