Skip to content

Commit

Permalink
docs(guide): fix typos in unit test guide
Browse files Browse the repository at this point in the history
  • Loading branch information
klokoy authored and pkozlowski-opensource committed Jan 7, 2013
1 parent 1122dc7 commit 2b0978b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/content/guide/dev_guide.unit-testing.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ in the right order. In order to answer such question it is very important that w
That is because when we are testing the sort function we don't want to be forced into crating
related pieces such as the DOM elements, or making any XHR calls in getting the data to sort. While
this may seem obvious it usually is very difficult to be able to call an individual function on a
typical project. The reason is that the developers often time mix concerns, and they end up with a
typical project. The reason is that the developers often mix concerns, and they end up with a
piece of code which does everything. It reads the data from XHR, it sorts it and then it
manipulates the DOM. With angular we try to make it easy for you to do the right thing, and so we
provide dependency injection for your XHR (which you can mock out) and we created abstraction which
Expand Down Expand Up @@ -173,7 +173,7 @@ for your application is mixed in with DOM manipulation, it will be hard to test
below:

<pre>
function PasswordController() {
function PasswordCtrl() {
// get references to DOM elements
var msg = $('.ex1 span');
var input = $('.ex1 input');
Expand Down Expand Up @@ -207,7 +207,7 @@ $('body').html('<div class="ex1">')
.find('div')
.append(input)
.append(span);
var pc = new PasswordController();
var pc = new PasswordCtrl();
input.val('abc');
pc.grade();
expect(span.text()).toEqual('weak');
Expand All @@ -218,7 +218,7 @@ In angular the controllers are strictly separated from the DOM manipulation logi
a much easier testability story as can be seen in this example:

<pre>
function PasswordCntrl($scope) {
function PasswordCtrl($scope) {
$scope.password = '';
$scope.grade = function() {
var size = $scope.password.length;
Expand All @@ -236,7 +236,7 @@ function PasswordCntrl($scope) {
and the tests is straight forward

<pre>
var pc = new PasswordController();
var pc = new PasswordCtrl();
pc.password('abc');
pc.grade();
expect(span.strength).toEqual('weak');
Expand Down

0 comments on commit 2b0978b

Please sign in to comment.