diff options
| author | Igor Minar | 2011-07-29 12:45:10 -0700 | 
|---|---|---|
| committer | Igor Minar | 2011-07-29 12:46:54 -0700 | 
| commit | a79231dea6cd13849c1a72d447f367e8c5053537 (patch) | |
| tree | c8f96ba0128df52c5c6f54e034eced9839615d57 /docs/content/guide/dev_guide.services.testing_services.ngdoc | |
| parent | 3e54a1b18ab698d55e1642a120f95ea3adf6af1b (diff) | |
| download | angular.js-a79231dea6cd13849c1a72d447f367e8c5053537.tar.bz2 | |
doc(guide): various fixes and improvements
Diffstat (limited to 'docs/content/guide/dev_guide.services.testing_services.ngdoc')
| -rw-r--r-- | docs/content/guide/dev_guide.services.testing_services.ngdoc | 41 | 
1 files changed, 22 insertions, 19 deletions
| diff --git a/docs/content/guide/dev_guide.services.testing_services.ngdoc b/docs/content/guide/dev_guide.services.testing_services.ngdoc index bc860364..2ec5877a 100644 --- a/docs/content/guide/dev_guide.services.testing_services.ngdoc +++ b/docs/content/guide/dev_guide.services.testing_services.ngdoc @@ -4,39 +4,42 @@  @description  Following is a unit test for the service in the example in {@link -dev_guide.services.registering_services Registering Angular Services}. The unit test example uses -Jasmine spy (mock) instead of a real browser alert. +dev_guide.services.creating_services Creating Angular Services}. The unit test example uses Jasmine +spy (mock) instead of a real browser alert.  <pre>  var mock, notify;  beforeEach(function() { -mock = {alert: jasmine.createSpy()}; -notify = angular.service('notify')(mock); +  mock = {alert: jasmine.createSpy()}; +  notify = angular.service('notify')(mock);  });  it('should not alert first two notifications', function() { -notify('one'); -notify('two'); -expect(mock.alert).not.toHaveBeenCalled(); +  notify('one'); +  notify('two'); + +  expect(mock.alert).not.toHaveBeenCalled();  });  it('should alert all after third notification', function() { -notify('one'); -notify('two'); -notify('three'); -expect(mock.alert).toHaveBeenCalledWith("one\ntwo\nthree"); +  notify('one'); +  notify('two'); +  notify('three'); + +  expect(mock.alert).toHaveBeenCalledWith("one\ntwo\nthree");  });  it('should clear messages after alert', function() { -notify('one'); -notify('two'); -notify('third'); -notify('more'); -notify('two'); -notify('third'); -expect(mock.alert.callCount).toEqual(2); -expect(mock.alert.mostRecentCall.args).toEqual(["more\ntwo\nthird"]); +  notify('one'); +  notify('two'); +  notify('third'); +  notify('more'); +  notify('two'); +  notify('third'); + +  expect(mock.alert.callCount).toEqual(2); +  expect(mock.alert.mostRecentCall.args).toEqual(["more\ntwo\nthird"]);  });  </pre> | 
