From e45599eac1b135c7cf79e94f70a4058d919c001f Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Thu, 15 Mar 2018 15:57:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AF=B9=E3=80=8A=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E3=80=8B=E8=BF=9B=E8=A1=8C=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aio/content/guide/testing.md | 48 ++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/aio/content/guide/testing.md b/aio/content/guide/testing.md index 8273528cfa..9d80cdf930 100644 --- a/aio/content/guide/testing.md +++ b/aio/content/guide/testing.md @@ -342,7 +342,7 @@ The test consumes that spy in the same way it did earlier. Most test suites in this guide call `beforeEach()` to set the preconditions for each `it()` test and rely on the `TestBed` to create classes and inject services. -本指南中的大多数的测试套件都会调用 `beforeEach()` 来为每个 `it()` 测试设置前置条件,并依赖 `TestBed` 来创建类和注入服务。 +本指南中的大多数的测试套件都会调用 `beforeEach()` 来为每个 `it()` 测试准备前置条件,并依赖 `TestBed` 来创建类和注入服务。 There's another school of testing that never calls `beforeEach()` and and prefers to create classes explicitly rather than use the `TestBed`. @@ -720,7 +720,7 @@ It also generates an initial test file for the component, `banner-external.compo #### Reduce the setup -#### 缩减设置代码 +#### 缩减准备代码 Only the last three lines of this file actually test the component and all they do is assert that Angular can create the component. @@ -839,7 +839,7 @@ Rather than duplicate the `TestBed` configuration for each test, you refactor to pull the setup into a Jasmine `beforeEach()` and some supporting variables: 随着该组件的成长,你将会添加更多测试。 -除了为每个测试都复制一份 `TestBed` 测试之外,你还可以把它们重构成 Jasmine 的 `beforeEach()` 中的设置语句以及一些支持性变量: +除了为每个测试都复制一份 `TestBed` 测试之外,你还可以把它们重构成 Jasmine 的 `beforeEach()` 中的准备语句以及一些支持性变量: @@ -2738,7 +2738,7 @@ When the `id` cannot be found, the component should re-route to the `HeroListCom The test suite setup provided the same router spy [described above](#routing-component) which spies on the router without actually navigating. -测试套件的设置代码提供了一个和[前面](#routing-component)一样的路由器间谍,它会充当路由器的角色,而不用发起实际的导航。 +测试套件的准备代码提供了一个和[前面](#routing-component)一样的路由器间谍,它会充当路由器的角色,而不用发起实际的导航。 This test expects the component to try to navigate to the `HeroListComponent`. @@ -2831,7 +2831,7 @@ That's too much effort just to answer a few simple questions about links. This section describes two techniques for minimizing the setup. Use them, alone or in combination, to stay focused on the testing the primary component. -本节会讲减少此类设置工作的两项技术。 +本节会讲减少此类准备工作的两项技术。 单独使用或组合使用它们,可以让这些测试聚焦于要测试的主要组件上。 {@a stub-component} @@ -2950,7 +2950,7 @@ need to interact with them in some way. In practice you will combine the two techniques in the same setup, as seen in this example. -在实践中,你可以在设置代码中组合使用这两种技术,例子如下: +在实践中,你可以在准备代码中组合使用这两种技术,例子如下: @@ -4055,7 +4055,7 @@ Here's a summary of the stand-alone functions, in order of likely utility: Runs the body of a test (`it`) or setup (`beforeEach`) function within a special _async test zone_. See [discussion above](#async). - 在一个特殊的* async 测试区域*中运行测试(`it`)的函数体或设置函数(`beforeEach`)。 + 在一个特殊的* async 测试区域*中运行测试(`it`)的函数体或准备函数(`beforeEach`)。 参见[前面的讨论](#async)。 @@ -4548,7 +4548,7 @@ Here are the most important static methods, in order of likely utility. You may call this method _exactly once_. If you must change this default in the middle of your test run, call `resetTestEnvironment` first. - 这个方法只能被调用**一次**。如果确实需要在测试程序运行期间变换这个默认设置,那么先调用`resetTestEnvironment`。 + 这个方法只能被调用**一次**。如果确实需要在测试程序运行期间改变这个默认设置,那么先调用`resetTestEnvironment`。 Specify the Angular compiler factory, a `PlatformRef`, and a default Angular testing module. Alternatives for non-browser platforms are available in the general form @@ -5342,7 +5342,7 @@ The component DOM tests describe in this guide often require extensive setup and advanced techniques where as the [class-only test](#component-class-testing) were comparatively simple. -本指南中讲的组件 DOM 测试通常需要大量的准备工作以及高级技巧,不像[只用类的测试](#component-class-testing)那样简单。 +本指南中讲的组件 DOM 测试通常需要大量的准备工作以及高级技巧,不像[只针对类的测试](#component-class-testing)那样简单。 Why not defer DOM integration tests to end-to-end (E2E) testing?