diff options
| author | Pete Bacon Darwin | 2013-06-04 22:10:04 +0100 | 
|---|---|---|
| committer | Pete Bacon Darwin | 2013-06-04 22:10:04 +0100 | 
| commit | c785b2edff50e9d9b1874d03d2399509d1aa062e (patch) | |
| tree | 6ba33e13f5442b957657fb2d196ffe88c9753412 /docs/content/guide/dev_guide.unit-testing.ngdoc | |
| parent | dc238ce123d6f4357878d0e6e58c8e2343337e26 (diff) | |
| download | angular.js-c785b2edff50e9d9b1874d03d2399509d1aa062e.tar.bz2 | |
docs(guide/unit-testing): fix controller test example
Diffstat (limited to 'docs/content/guide/dev_guide.unit-testing.ngdoc')
| -rw-r--r-- | docs/content/guide/dev_guide.unit-testing.ngdoc | 9 | 
1 files changed, 5 insertions, 4 deletions
| diff --git a/docs/content/guide/dev_guide.unit-testing.ngdoc b/docs/content/guide/dev_guide.unit-testing.ngdoc index c27180fe..e6bf7aa4 100644 --- a/docs/content/guide/dev_guide.unit-testing.ngdoc +++ b/docs/content/guide/dev_guide.unit-testing.ngdoc @@ -248,10 +248,11 @@ function PasswordCtrl($scope) {  and the test is straight forward  <pre> -var pc = new PasswordCtrl(); -pc.password('abc'); -pc.grade(); -expect(pc.strength).toEqual('weak'); +var $scope = {}; +var pc = $controller('PasswordCtrl', { $scope: $scope }); +$scope.password = 'abc'; +$scope.grade(); +expect($scope.strength).toEqual('weak');  </pre>  Notice that the test is not only much shorter but it is easier to follow what is going on. We say | 
