docs(guide/unit-testing): fix controller test example

This commit is contained in:
Pete Bacon Darwin 2013-06-04 22:10:04 +01:00
parent dc238ce123
commit c785b2edff

View file

@ -248,10 +248,11 @@ function PasswordCtrl($scope) {
and the test is straight forward and the test is straight forward
<pre> <pre>
var pc = new PasswordCtrl(); var $scope = {};
pc.password('abc'); var pc = $controller('PasswordCtrl', { $scope: $scope });
pc.grade(); $scope.password = 'abc';
expect(pc.strength).toEqual('weak'); $scope.grade();
expect($scope.strength).toEqual('weak');
</pre> </pre>
Notice that the test is not only much shorter but it is easier to follow what is going on. We say Notice that the test is not only much shorter but it is easier to follow what is going on. We say