diff options
| author | Vojta Jina | 2012-03-09 17:19:48 -0800 |
|---|---|---|
| committer | Vojta Jina | 2012-03-09 17:33:22 -0800 |
| commit | 716dd5f3f90f853713706aa3b404822fef18ef93 (patch) | |
| tree | eb30e28a834c70fb1d799ad2cba0014171445ae7 /test | |
| parent | 83314913e717f18cdb9a817e67c24651930ebe7e (diff) | |
| download | angular.js-716dd5f3f90f853713706aa3b404822fef18ef93.tar.bz2 | |
refactor(forms): Remove touch() method
Diffstat (limited to 'test')
| -rw-r--r-- | test/directive/formSpec.js | 2 | ||||
| -rw-r--r-- | test/directive/inputSpec.js | 36 |
2 files changed, 18 insertions, 20 deletions
diff --git a/test/directive/formSpec.js b/test/directive/formSpec.js index 6559da5d..45af04a4 100644 --- a/test/directive/formSpec.js +++ b/test/directive/formSpec.js @@ -197,7 +197,7 @@ describe('form', function() { it('should have ng-pristine/ng-dirty css class', function() { expect(doc).toBePristine(); - widget.touch(); + widget.setViewValue(''); scope.$apply(); expect(doc).toBeDirty(); }); diff --git a/test/directive/inputSpec.js b/test/directive/inputSpec.js index e7c40b0a..6298fc64 100644 --- a/test/directive/inputSpec.js +++ b/test/directive/inputSpec.js @@ -34,25 +34,6 @@ describe('NgModelController', function() { }); - describe('touch', function() { - it('should only fire $viewTouch when pristine', function() { - var spy = jasmine.createSpy('$viewTouch'); - scope.$on('$viewTouch', spy); - - ctrl.touch(); - expect(ctrl.pristine).toBe(false); - expect(ctrl.dirty).toBe(true); - expect(spy).toHaveBeenCalledOnce(); - - spy.reset(); - ctrl.touch(); - expect(ctrl.pristine).toBe(false); - expect(ctrl.dirty).toBe(true); - expect(spy).not.toHaveBeenCalled(); - }); - }); - - describe('setValidity', function() { it('should emit $invalid only when $valid', function() { @@ -150,6 +131,23 @@ describe('NgModelController', function() { ctrl.setViewValue('val'); expect(spy).not.toHaveBeenCalled(); }); + + + it('should only fire $viewTouch when pristine', function() { + var spy = jasmine.createSpy('$viewTouch'); + scope.$on('$viewTouch', spy); + + ctrl.setViewValue(''); + expect(ctrl.pristine).toBe(false); + expect(ctrl.dirty).toBe(true); + expect(spy).toHaveBeenCalledOnce(); + + spy.reset(); + ctrl.setViewValue(''); + expect(ctrl.pristine).toBe(false); + expect(ctrl.dirty).toBe(true); + expect(spy).not.toHaveBeenCalled(); + }); }); |
