aboutsummaryrefslogtreecommitdiffstats
path: root/docs/content/guide/dev_guide.unit-testing.ngdoc
diff options
context:
space:
mode:
authorIgor Minar2011-06-15 22:32:24 -0700
committerIgor Minar2011-06-15 22:32:24 -0700
commit3c87611188fc1612fe5d07e245a992b25146f2bf (patch)
tree3a08e9ee80ab7abdd2b516f66e62ddb7554d6954 /docs/content/guide/dev_guide.unit-testing.ngdoc
parentb842642b574a2b95c53b791308ed1bf8ff9d304d (diff)
downloadangular.js-3c87611188fc1612fe5d07e245a992b25146f2bf.tar.bz2
docs - various doc fixes
Diffstat (limited to 'docs/content/guide/dev_guide.unit-testing.ngdoc')
-rw-r--r--docs/content/guide/dev_guide.unit-testing.ngdoc17
1 files changed, 5 insertions, 12 deletions
diff --git a/docs/content/guide/dev_guide.unit-testing.ngdoc b/docs/content/guide/dev_guide.unit-testing.ngdoc
index e068e26d..459b6b93 100644
--- a/docs/content/guide/dev_guide.unit-testing.ngdoc
+++ b/docs/content/guide/dev_guide.unit-testing.ngdoc
@@ -150,13 +150,11 @@ function MyClass(xhr) {
}
</pre>
-
-This is the proferred way since the code makes no assumptions as to where the `xhr` comes from,
-rather that who-ever crated the class was responsible for passing it in. Since the creator of the
-class should be different code the the user of the class, it separates the responsibility of
+This is the preferred way since the code makes no assumptions as to where the `xhr` comes from,
+rather that whoever created the class was responsible for passing it in. Since the creator of the
+class should be different code than the user of the class, it separates the responsibility of
creation from the logic, and that is what dependency-injection is in a nutshell.
-
The class above is very testable, since in the test we can write:
<pre>
function xhrMock(args) {...}
@@ -165,21 +163,16 @@ myClass.doWork();
// assert that xhrMock got called with the right arguments
</pre>
-
Notice that no global variables were harmed in the writing of this test.
-
-Angular comes with {@link dev_guide.di dependency-injection} built in which makes the right thin
-the easy thing to do, but you still need to do it if you wish to take advantage of the testability
-story.
-
+Angular comes with {@link dev_guide.di dependency-injection} built in which makes the right thing
+easy to do, but you still need to do it if you wish to take advantage of the testability story.
## Controllers
What makes each application unique is its logic, which is what we would like to test. If the logic
for your application is mixed in with DOM manipulation, it will be hard to test as in the example
below:
-
<pre>
function PasswordController(){
// get references to DOM elements