diff --git a/public/docs/ts/latest/guide/testing.jade b/public/docs/ts/latest/guide/testing.jade index 55deef0495..d688d48ced 100644 --- a/public/docs/ts/latest/guide/testing.jade +++ b/public/docs/ts/latest/guide/testing.jade @@ -18,7 +18,6 @@ a#top [在线例子](#live-examples "本章这些测试的在线例子") -

* [Introduction to Angular testing](#testing-intro) [Angular测试简介](#testing-intro) @@ -40,25 +39,23 @@ a#top [第一个Karma测试](#1st-karma-test) - - * [Run with karma](#run-karma) - - [运行Karma](#run-karma) - - * [Test debugging](#test-debugging) - - [调试测试代码](#test-debugging) - - * [Try the live example](#live-karma-example) - - [试用在线例子](#live-karma-example) - + * [Run with karma](#run-karma) + + [运行Karma](#run-karma) + + * [Test debugging](#test-debugging) + + [调试测试代码](#test-debugging) + + * [Try the live example](#live-karma-example) + + [试用在线例子](#live-karma-example) + * [Test a component](#simple-component-test) [测试一个组件](#simple-component-test) - * [_TestBed_](#testbed) * [_createComponent_](#create-component) @@ -88,7 +85,6 @@ a#top [测试带有外部模板的组件](#component-with-external-template) - * [The first asynchronous _beforeEach_](#async-in-before-each) [第一处异步代码:_beforeEach_](#async-in-before-each) @@ -112,7 +108,6 @@ a#top [测试依赖服务的组件](#component-with-dependency) - * [Provide service test doubles](#service-test-doubles) [测试复制品](#service-test-doubles) @@ -136,7 +131,6 @@ a#top [测试带有异步服务的组件](#component-with-async-service) - * [Spying on the real service](#service-spy) [监听真实的服务](#service-spy) @@ -165,7 +159,6 @@ a#top [测试带有输入属性和输出属性的组件](#component-with-input-output) - * [Test _DashboardHeroComponent_ stand-alone](#dashboard-standalone) [单独测试`DashboardHeroComponent`](#dashboard-standalone) @@ -176,12 +169,10 @@ a#top [在宿主组件中测试组件](#component-inside-test-host) - * [Test a routed component](#routed-component) [测试路由组件](#routed-component) - * [The _inject_ helper function](#inject) [`inject`助手函数](#inject) @@ -198,7 +189,6 @@ a#top [使用`Observable`测试桩进行测试](#tests-w-observable-double) - * [Use a _page_ object to simplify setup](#page-object) [使用`page`对象来简化设置](#page-object) @@ -211,12 +201,10 @@ a#top [导入特性模块](#feature-module-import) -

* [Override a component's providers](#component-override) [改写(Override)组件的提供商](#component-override) - * [The _overrideComponent_ method](#override-component-method) [`overrideComponent`方法](#override-component-method) @@ -238,7 +226,6 @@ a#top [测试`RouterOutlet`组件](#router-outlet-component) - * [Stubbing unneeded components](#stub-component) [模拟不需要的组件](#stub-component) @@ -260,17 +247,14 @@ a#top [使用`NO\_ERRORS\_SCHEMA`进行 "浅组件测试" ](#shallow-component-test) -

* [Test an attribute directive](#attribute-directive) [测试属性型指令](#attribute-directive) -

* [Isolated unit tests](#isolated-unit-tests "Unit testing without the Angular testing utilities") [独立的单元测试](#isolated-unit-tests "不使用Angular测试工具集的单元测试方式") - * [Services](#isolated-service-tests) [服务](#isolated-service-tests) @@ -296,7 +280,6 @@ a#top [Angular单元测试工具类 API ](#atu-apis) - * [_TestBed_ class summary](#testbed-class-summary) [`TestBed`总结](#testbed-class-summary) @@ -322,7 +305,6 @@ a#top [测试环境设置所需的文件](#setup-files) - * [npm packages](#npm-packages) [npm包](#npm-packages) @@ -493,9 +475,13 @@ table(width="100%") a#setup :marked ### Setup + + ### 环境设置 There are two fast paths to getting started with unit testing. + 要开始单元测试,有两条捷径: + 1. Start a new project following the instructions in [Setup](setup.html "Setup"). 遵循[环境设置](setup.html "环境设置")中给出的步骤开始一个新项目。 @@ -514,10 +500,15 @@ a#setup In this guide, the application and its tests are based on the [setup instructions](setup.html "Setup"). For a discussion of the unit testing setup files, [see below](#setup-files). + + 本章中,该应用及其测试都是基于[环境设置步骤](setup.html "Setup")的。 + 对单元测试的环境设置文件的讨论,[参见后面](#setup-files)。 a#isolated-v-testing-utilities :marked ### Isolated unit tests vs. the Angular testing utilites + + ### 独立单元测试 vs. Angular测试工具集 [Isolated unit tests](#isolated-unit-tests "Unit testing without the Angular testing utilities") examine an instance of a class all by itself without any dependence on Angular or any injected values.