anchor.diff:    The `jasmine.done` technique, while discouraged, may become necessary when neither `async` nor `fakeAsync`
     can tolerate a particular asynchronous activity. That's rare but it happens.
   
  -  虽然不推荐使用`jasmine.done`技术，但是它可能在`async`和`fakeAsync`都无法容纳一个特定的异步行为时，变得很有必要。很少见，但是有可能发生。
  +  虽然不推荐使用`jasmine.done`技术，但是它可能在`async`和`fakeAsync`都无法容纳一个特定的异步行为时，变得很有必要。这很少见，但是有可能发生。
   
   a(href="#top").to-top Back to top
   a(href="#top").to-top 返回顶部
  
positive.code:   The `WelcomeComponent` has decision logic that interacts with the service, logic that makes this component worth testing.
    Here's the testing module configuration for the spec file, `app/welcome.component.spec.ts`:
  
    `WelcomeComponent`有与服务进行交互的决策逻辑，这样的逻辑让这个组件值得测试。下面是测试配置文件的测试模块配置，`app/welcome.component.spec.ts`：
  
  +makeExample('testing/ts/app/welcome.component.spec.ts', 'config-test-module', 'app/welcome.component.spec.ts')(format='.')
  :marked
  
negative.code: #component-with-external-template
  :marked
    # Test a component with an external template
  
    # 测试有外部模板的组件
  
    The `TestBed.createComponent` is a synchronous method. 
    It assumes that everything it could need is already in memory.
  
    `TestBed.createComponent`时一个同步的方法。它假设所有它需要的资源已经全部在内存。
  
    That has been true so far. 
    Each tested component's `@Component` metadata has a `template` property specifying an _inline templates_.
    Neither component had a `styleUrls` property.
    Everything necessary to compile them was in memory at test runtime.
  
    到目前为止还是这样的。
    每个被测试的组件的`@Component`元数据都有一个`template`属性，制定一个**内联模板**。
    没有组件有`styleUrls`属性。所有编译它们所需要的资源，在测试时都已经在内存里。
  
    The `DashboardHeroComponent` is different. 
    It has an external template and external css file, specified in `templateUrl` and `styleUrls` properties.
  
    `DashbaordComponent`不一样。
    它有一个外部的模板和外部CSS文件，是在`templateUrl`和`styleUrls`属性分别配置的。
  +makeExample('testing/ts/app/dashboard/dashboard-hero.component.ts', 'component', 'app/dashboard/dashboard-hero.component.ts (component)')(format='.')
  :marked
    The compiler must read these files from a file system before it can create a component instance.
  
    编译器必须预先从一个文件系统读取这些文件，它才能创建一个组件实例。
  
    The `TestBed.compileComponents` method asynchronously compiles all the components configured in its
    current testing module. After it completes, external templates and css files, have been "inlined"
    and `TestBed.createComponent` can do its job synchronously.
  
    `TestBed.compileComponents`方法异步编译所有当前测试模块配置的组件。完成编译后，外部模板和CSS文件就已经被**内联**进来，
    然后`TestBed.createComponent`就可以异步的完成它的任务了。
  .l-sub-section
    :marked
      WebPack developers need not call `compileComponents` because it inlines templates and css
      as part of the automated build process that precedes running the test.
  
      WebPack开发者不需要调用`compileComponents`，因为在运行测试时，内联模板和CSS文件是自动编译流程的一部分。
  :marked
    The `app/dashboard/dashboard-hero.component.spec.ts` demonstrates the pre-compilation process:
  
    `app/dashboard/dashboard-hero.component.spec.ts`展示了预编译的过程：
  +makeExample('testing/ts/app/dashboard/dashboard-hero.component.spec.ts', 'compile-components', 'app/dashboard/dashboard-hero.component.spec.ts (compileComponents)')(format='.')
  
  #async-in-before-each
  :marked
    ## The _async_ function in _beforeEach_
  
    ## **beforeEach**里的**async**函数
  
    Notice the `async` call in the `beforeEach`. 
    The `async` function arranges for the tester's code to run in a special _async test zone_
    that hides the mechanics of asynchronous execution, just as it does when passed to an [_it_ test)(#async).
  
    注意`beforeEach`里面对`async`的调用。
    `async`函数将测试代码安排到一个特殊的**异步测试区域**来运行，该区域隐藏了异步执行的细节，就像它被传递给一个[_it_ 测试)(#async)一样。
  
  #compile-components
  :marked
    ## _compileComponents_ 
  
    ## _compileComponents_ 
   
    In this example, `TestBed.compileComponents` compiles one component, the `DashboardComponent`. 
    It's the only declared component in this testing module.
  
    在本例中，`TestBed.compileComponents`编译了一个组件，那就是`DashbaordComponent`。
    它是这个测试模块唯一的声明组件。
  
    Tests later in this chapter have more declared components and some of them import application
    modules that declare yet more components.
    Some or all of these components could have external templates and css files.
    `TestBed.compileComponents` compiles them all asynchonously at one time.
  
    本章后面的测试有更多声明组件，它们中间的一些导入应用模块，这些模块有更多的声明组件。
    一部分或者全部组件可能有外部模板和CSS文件。
    `TestBed.compileComponents`一次性异步编译所有组件。
    
    The `compileComponents` method returns a promise so you can perform additional tasks _after_ it finishes.
  
    `compileComponents`方法返回一个承诺，可以用来在它完成时候，执行更多额外任务。
  
    ### _compileComponents_ closes configuration
  
    ### _compileComponents_ 关闭配置
  
    After `compileComponents` runs, the current `TestBed` instance is closed to further configuration.
    You cannot call any more `TestBed` configuration methods, not `configureTestModule` 
    nor any of the `override...` methods. The `TestBed` throws an error if you try.
  
    `compileComponents`运行之后，当前的`TestBed`实例就不能再次被配置了。
    你不能再调用任何`TestBed`配置方法、`configureTestModule`或者任何`override...`方法，否则`TestBed`将会抛出一个错误。
  
  .alert.is-important
    :marked
      Do not configure the `TestBed` after calling `compileComponents`. 
      Make `compileComponents` the last step 
      before calling `TestBed.createInstance` to instantiate the _component-under-test_.
  
      不要再调用`compileComponents`之后再配置`TestBed`。
      在调用`TestBed.createInstance`来初始化被测试的组件之前，把`compileComponents`的调用放到最后一步。
  :marked
    The `DashboardHeroComponent` spec follows the asynchonous `beforeEach` with a
    _synchronous_ `beforeEach` that completes the setup steps and runs tests ... as described in the next section.
  
    `DashboardHeroComponent`spec中，异步的`beforeEach`下面紧接着**同步**的`beforeEach`，
    用来完成设置步骤和运行测试...下面小节做了详细的解释。                                                                                                                                         
  
  .l-hr
  
  