修正格式问题
This commit is contained in:
parent
9e8397cf1c
commit
4a865c6582
@ -18,7 +18,6 @@ a#top
|
|||||||
|
|
||||||
[在线例子](#live-examples "本章这些测试的在线例子")
|
[在线例子](#live-examples "本章这些测试的在线例子")
|
||||||
|
|
||||||
<br><br>
|
|
||||||
* [Introduction to Angular testing](#testing-intro)
|
* [Introduction to Angular testing](#testing-intro)
|
||||||
|
|
||||||
[Angular测试简介](#testing-intro)
|
[Angular测试简介](#testing-intro)
|
||||||
@ -40,25 +39,23 @@ a#top
|
|||||||
|
|
||||||
[第一个Karma测试](#1st-karma-test)
|
[第一个Karma测试](#1st-karma-test)
|
||||||
|
|
||||||
|
* [Run with karma](#run-karma)
|
||||||
* [Run with karma](#run-karma)
|
|
||||||
|
[运行Karma](#run-karma)
|
||||||
[运行Karma](#run-karma)
|
|
||||||
|
* [Test debugging](#test-debugging)
|
||||||
* [Test debugging](#test-debugging)
|
|
||||||
|
[调试测试代码](#test-debugging)
|
||||||
[调试测试代码](#test-debugging)
|
|
||||||
|
* [Try the live example](#live-karma-example)
|
||||||
* [Try the live example](#live-karma-example)
|
|
||||||
|
[试用在线例子](#live-karma-example)
|
||||||
[试用在线例子](#live-karma-example)
|
|
||||||
|
|
||||||
|
|
||||||
* [Test a component](#simple-component-test)
|
* [Test a component](#simple-component-test)
|
||||||
|
|
||||||
[测试一个组件](#simple-component-test)
|
[测试一个组件](#simple-component-test)
|
||||||
|
|
||||||
|
|
||||||
* [_TestBed_](#testbed)
|
* [_TestBed_](#testbed)
|
||||||
|
|
||||||
* [_createComponent_](#create-component)
|
* [_createComponent_](#create-component)
|
||||||
@ -88,7 +85,6 @@ a#top
|
|||||||
|
|
||||||
[测试带有外部模板的组件](#component-with-external-template)
|
[测试带有外部模板的组件](#component-with-external-template)
|
||||||
|
|
||||||
|
|
||||||
* [The first asynchronous _beforeEach_](#async-in-before-each)
|
* [The first asynchronous _beforeEach_](#async-in-before-each)
|
||||||
|
|
||||||
[第一处异步代码:_beforeEach_](#async-in-before-each)
|
[第一处异步代码:_beforeEach_](#async-in-before-each)
|
||||||
@ -112,7 +108,6 @@ a#top
|
|||||||
|
|
||||||
[测试依赖服务的组件](#component-with-dependency)
|
[测试依赖服务的组件](#component-with-dependency)
|
||||||
|
|
||||||
|
|
||||||
* [Provide service test doubles](#service-test-doubles)
|
* [Provide service test doubles](#service-test-doubles)
|
||||||
|
|
||||||
[测试复制品](#service-test-doubles)
|
[测试复制品](#service-test-doubles)
|
||||||
@ -136,7 +131,6 @@ a#top
|
|||||||
|
|
||||||
[测试带有异步服务的组件](#component-with-async-service)
|
[测试带有异步服务的组件](#component-with-async-service)
|
||||||
|
|
||||||
|
|
||||||
* [Spying on the real service](#service-spy)
|
* [Spying on the real service](#service-spy)
|
||||||
|
|
||||||
[监听真实的服务](#service-spy)
|
[监听真实的服务](#service-spy)
|
||||||
@ -165,7 +159,6 @@ a#top
|
|||||||
|
|
||||||
[测试带有输入属性和输出属性的组件](#component-with-input-output)
|
[测试带有输入属性和输出属性的组件](#component-with-input-output)
|
||||||
|
|
||||||
|
|
||||||
* [Test _DashboardHeroComponent_ stand-alone](#dashboard-standalone)
|
* [Test _DashboardHeroComponent_ stand-alone](#dashboard-standalone)
|
||||||
|
|
||||||
[单独测试`DashboardHeroComponent`](#dashboard-standalone)
|
[单独测试`DashboardHeroComponent`](#dashboard-standalone)
|
||||||
@ -176,12 +169,10 @@ a#top
|
|||||||
|
|
||||||
[在宿主组件中测试组件](#component-inside-test-host)
|
[在宿主组件中测试组件](#component-inside-test-host)
|
||||||
|
|
||||||
|
|
||||||
* [Test a routed component](#routed-component)
|
* [Test a routed component](#routed-component)
|
||||||
|
|
||||||
[测试路由组件](#routed-component)
|
[测试路由组件](#routed-component)
|
||||||
|
|
||||||
|
|
||||||
* [The _inject_ helper function](#inject)
|
* [The _inject_ helper function](#inject)
|
||||||
|
|
||||||
[`inject`助手函数](#inject)
|
[`inject`助手函数](#inject)
|
||||||
@ -198,7 +189,6 @@ a#top
|
|||||||
|
|
||||||
[使用`Observable`测试桩进行测试](#tests-w-observable-double)
|
[使用`Observable`测试桩进行测试](#tests-w-observable-double)
|
||||||
|
|
||||||
|
|
||||||
* [Use a _page_ object to simplify setup](#page-object)
|
* [Use a _page_ object to simplify setup](#page-object)
|
||||||
|
|
||||||
[使用`page`对象来简化设置](#page-object)
|
[使用`page`对象来简化设置](#page-object)
|
||||||
@ -211,12 +201,10 @@ a#top
|
|||||||
|
|
||||||
[导入特性模块](#feature-module-import)
|
[导入特性模块](#feature-module-import)
|
||||||
|
|
||||||
<br><br>
|
|
||||||
* [Override a component's providers](#component-override)
|
* [Override a component's providers](#component-override)
|
||||||
|
|
||||||
[改写(Override)组件的提供商](#component-override)
|
[改写(Override)组件的提供商](#component-override)
|
||||||
|
|
||||||
|
|
||||||
* [The _overrideComponent_ method](#override-component-method)
|
* [The _overrideComponent_ method](#override-component-method)
|
||||||
|
|
||||||
[`overrideComponent`方法](#override-component-method)
|
[`overrideComponent`方法](#override-component-method)
|
||||||
@ -238,7 +226,6 @@ a#top
|
|||||||
|
|
||||||
[测试`RouterOutlet`组件](#router-outlet-component)
|
[测试`RouterOutlet`组件](#router-outlet-component)
|
||||||
|
|
||||||
|
|
||||||
* [Stubbing unneeded components](#stub-component)
|
* [Stubbing unneeded components](#stub-component)
|
||||||
|
|
||||||
[模拟不需要的组件](#stub-component)
|
[模拟不需要的组件](#stub-component)
|
||||||
@ -260,17 +247,14 @@ a#top
|
|||||||
|
|
||||||
[使用`NO\_ERRORS\_SCHEMA`进行 "浅组件测试" ](#shallow-component-test)
|
[使用`NO\_ERRORS\_SCHEMA`进行 "浅组件测试" ](#shallow-component-test)
|
||||||
|
|
||||||
<br><br>
|
|
||||||
* [Test an attribute directive](#attribute-directive)
|
* [Test an attribute directive](#attribute-directive)
|
||||||
|
|
||||||
[测试属性型指令](#attribute-directive)
|
[测试属性型指令](#attribute-directive)
|
||||||
|
|
||||||
<br><br>
|
|
||||||
* [Isolated unit tests](#isolated-unit-tests "Unit testing without the Angular testing utilities")
|
* [Isolated unit tests](#isolated-unit-tests "Unit testing without the Angular testing utilities")
|
||||||
|
|
||||||
[独立的单元测试](#isolated-unit-tests "不使用Angular测试工具集的单元测试方式")
|
[独立的单元测试](#isolated-unit-tests "不使用Angular测试工具集的单元测试方式")
|
||||||
|
|
||||||
|
|
||||||
* [Services](#isolated-service-tests)
|
* [Services](#isolated-service-tests)
|
||||||
|
|
||||||
[服务](#isolated-service-tests)
|
[服务](#isolated-service-tests)
|
||||||
@ -296,7 +280,6 @@ a#top
|
|||||||
|
|
||||||
[Angular单元测试工具类 API ](#atu-apis)
|
[Angular单元测试工具类 API ](#atu-apis)
|
||||||
|
|
||||||
|
|
||||||
* [_TestBed_ class summary](#testbed-class-summary)
|
* [_TestBed_ class summary](#testbed-class-summary)
|
||||||
|
|
||||||
[`TestBed`总结](#testbed-class-summary)
|
[`TestBed`总结](#testbed-class-summary)
|
||||||
@ -322,7 +305,6 @@ a#top
|
|||||||
|
|
||||||
[测试环境设置所需的文件](#setup-files)
|
[测试环境设置所需的文件](#setup-files)
|
||||||
|
|
||||||
|
|
||||||
* [npm packages](#npm-packages)
|
* [npm packages](#npm-packages)
|
||||||
|
|
||||||
[npm包](#npm-packages)
|
[npm包](#npm-packages)
|
||||||
@ -493,9 +475,13 @@ table(width="100%")
|
|||||||
a#setup
|
a#setup
|
||||||
:marked
|
:marked
|
||||||
### Setup
|
### Setup
|
||||||
|
|
||||||
|
### 环境设置
|
||||||
|
|
||||||
There are two fast paths to getting started with unit testing.
|
There are two fast paths to getting started with unit testing.
|
||||||
|
|
||||||
|
要开始单元测试,有两条捷径:
|
||||||
|
|
||||||
1. Start a new project following the instructions in [Setup](setup.html "Setup").
|
1. Start a new project following the instructions in [Setup](setup.html "Setup").
|
||||||
|
|
||||||
遵循[环境设置](setup.html "环境设置")中给出的步骤开始一个新项目。
|
遵循[环境设置](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").
|
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).
|
For a discussion of the unit testing setup files, [see below](#setup-files).
|
||||||
|
|
||||||
|
本章中,该应用及其测试都是基于[环境设置步骤](setup.html "Setup")的。
|
||||||
|
对单元测试的环境设置文件的讨论,[参见后面](#setup-files)。
|
||||||
|
|
||||||
a#isolated-v-testing-utilities
|
a#isolated-v-testing-utilities
|
||||||
:marked
|
:marked
|
||||||
### Isolated unit tests vs. the Angular testing utilites
|
### Isolated unit tests vs. the Angular testing utilites
|
||||||
|
|
||||||
|
### 独立单元测试 vs. Angular测试工具集
|
||||||
|
|
||||||
[Isolated unit tests](#isolated-unit-tests "Unit testing without the Angular testing utilities")
|
[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.
|
examine an instance of a class all by itself without any dependence on Angular or any injected values.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user