merging testing.jade with angular.io master

This commit is contained in:
rexebin 2016-09-23 23:07:18 +01:00
parent 3c49c10c12
commit acead8a078
1 changed files with 13 additions and 5 deletions

View File

@ -205,10 +205,16 @@ block includes
1. [隔离的单元测试](#isolated-unit-tests "Unit testing without the Angular testing utilities")
- [Services](#isolated-service-tests)
- [服务](#isolated-service-tests)
- [Pipes](#isolated-pipe-tests)
- [管道](#isolated-pipe-tests)
- [Components](#isolated-component-tests)
- [组件](#isolated-component-tests)
1. [Angular testing utility APIs](#atu-apis)
@ -703,6 +709,8 @@ a(href="#top").to-top 回到顶部
你可以,也应该为服务和管道编写孤立的单元测试。
+makeExample('testing/ts/app/shared/title-case.pipe.spec.ts', 'mini-excerpt', 'app/shared/title-case.pipe.spec.ts (excerpt)')
:marked
Components can be tested in isolation as well.
However, isolated unit tests don't reveal how these classes interact with Angular.
@ -1158,7 +1166,7 @@ a(href="#top").to-top 回到顶部
出人意料的是,你不敢引用测试代码里提供给测试模块`userServiceStub`对象。**它是行不通的!**。
被注入组件的`userService`实例是一个彻底**不一样**的对象,是提供的`userServiceStub`的克隆。
+makeExample('testing/ts/app/welcome.component.spec.ts', 'injected-service', 'Component\'s injector')(format='.')
+makeExample('testing/ts/app/welcome.component.spec.ts', 'stub-not-injected')(format='.')
#welcome-spec-setup
:marked