Skip to content

Commit 8fcbcb8

Browse files
committed
fixed links
1 parent e5209db commit 8fcbcb8

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

Chapter3.markdown

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,14 @@ Yeoman让你很简单的使用一个Web服务器服务你所有的静态资源
182182

183183
###Karma
184184

185-
Karma存在的主要的原因是它让你的测试驱动开发(TDD)流程变得简单, 快速和有趣. 它使用NodeJS和SocketIO(你不需要知道它们是什么, 只需要假设它们是很棒很酷的库), 并允许在多个浏览器中及其快速的运行你的代码和测试. 在[https://github.com/vojtajina/karma/](https:// github.com/vojtajina/karma/)中可以找到更多信息.
185+
Karma存在的主要的原因是它让你的测试驱动开发(TDD)流程变得简单, 快速和有趣. 它使用NodeJS和SocketIO(你不需要知道它们是什么, 只需要假设它们是很棒很酷的库), 并允许在多个浏览器中及其快速的运行你的代码和测试. 在[https://github.com/vojtajina/karma/](https://github.com/vojtajina/karma/)中可以找到更多信息.
186186

187187
> **TDD简介**
188188
>
189189
> 测试驱动开发或者TDD, 是一个通过确保在开发生命周期内首先编写测试的敏捷方法, 这是在代码实现之前进行的, 这就是测试驱动的开发(不只是作为一种验证工具).
190190
>
191191
> TDD的原则很简单:
192-
>
192+
>
193193
+ 代码只需要在一个所需要的代码测试失败时编写.
194194
+ 编写最少的代码以确保测试通过.
195195
+ 在每一步删除重复代码.
@@ -298,7 +298,7 @@ Scenario Runner允许你按照类Jasmine的语法来描述应用程序. 正如
298298
b. 添加一个代理服务器将请求定位到正确的测试文件所在目录, 例如:
299299

300300
proxies = {'/': 'http://localhost:8000/test/e2e'};
301-
301+
302302
c. 添加一个Karma root(根目录/基础路径)以确保Karma的源文件不会干扰你的测试, 像这样:
303303

304304
urlRoot = '/_karma_/';
@@ -323,7 +323,7 @@ Angular场景情运行器, 顾名思义, 它是由Angular创建的. 因此, 他
323323

324324
Angular意识也意味着Angular直到所有的XHR何时向服务器放出, 从而可以避免页面加载所等待的间隔时间. 场景运行器直到何时加载一个页面, 从而比Selenium测试更具确定性, 例如, 超时等待页面加载时任务可能失败.
325325

326-
**调试功能**
326+
**调试功能**
327327

328328
探究JavaScript, 如果你查看你的代码不是很好; 当你希望暂停和恢复测试时, 所有的这些都运行场景测试吗? 然而所有的这一切通过Angular场景运行器都是可行的, 等等.
329329

@@ -455,9 +455,11 @@ Figure 3-5. AngularJS properties within Batarang
455455

456456
curl -L get .yeoman.io | bash
457457

458+
> 译注: Yeoman 已经可以通过 npm 安装 `npm install -g yeoman`
459+
458460
然后只需按照打印的只是来获取Yeoman.
459461

460-
对于Windows机器, 或者运行它是遇到任何问题, 到[https://github.com/yeoman/yeoman/ wiki/Manual-Install](https://github.com/yeoman/yeoman/ wiki/Manual-Install)并按照说明来安装会让你畅通无阻.
462+
对于Windows机器, 或者运行它是遇到任何问题, 到[https://github.com/yeoman/yeoman/wiki/Manual-Install](https://github.com/yeoman/yeoman/wiki/Manual-Install)并按照说明来安装会让你畅通无阻.
461463

462464
###启动一个新的AngularJS项目
463465

@@ -541,7 +543,7 @@ Yeoman不支持压缩文件, 但是根据来发者提供的信息, 它很快会
541543
c. /**script**: 主AngularJS代码库. 这个目录也包括我们的引导程序代码, 主要的RequireJS集成
542544

543545
i. /**controllers**: 这里是AngularJS控制器
544-
546+
545547
ii. /**directives**: 这里是AngularJS指令
546548

547549
iii. /**filters**: 这里是AngularJS过滤器
@@ -727,7 +729,7 @@ Yeoman不支持压缩文件, 但是根据来发者提供的信息, 它很快会
727729

728730
// web server port
729731
port = 8989;
730-
732+
731733
// cli runner port
732734
runnerPort = 9898;
733735

@@ -740,18 +742,18 @@ Yeoman不支持压缩文件, 但是根据来发者提供的信息, 它很快会
740742
// enable/disable watching file and executing tests whenever any file changes
741743
autoWatch = true;
742744

743-
// Start these browsers, currently available:
745+
// Start these browsers, currently available:
744746
// - Chrome
745747
// - ChromeCanary
746748
// - Firefox
747749
// - Opera
748750
// - Safari
749751
// - PhantomJS
750-
// - IE if you have a windows box
752+
// - IE if you have a windows box
751753
browsers = ['Chrome'];
752-
754+
753755
// Cont inuous Integrat ion mode
754-
// if true, it captures browsers, runs tests, and exits
756+
// if true, it captures browsers, runs tests, and exits
755757
singleRun = false;
756758
```
757759
我们使用一个稍微不同的格式来定义的我们的依赖(包括: false是非常重要的). 我们还添加了REQUIRE_JS和适配依赖. 最终进行这一系列工作的是`main.js`, 他会触发我们的测试.
@@ -760,7 +762,7 @@ Yeoman不支持压缩文件, 但是根据来发者提供的信息, 它很快会
760762

761763
require.config({
762764
// !! Karma serves files from '/base'
763-
// (in this case, it is the root of the project /your-project/app/js)
765+
// (in this case, it is the root of the project /your-project/app/js)
764766
baseUrl: ' /base/app/scr ipts' ,
765767
paths: {
766768
angular: 'vendor/angular/angular.min',
@@ -817,7 +819,7 @@ Yeoman不支持压缩文件, 但是根据来发者提供的信息, 它很快会
817819
elem = $compi le('<input type=”text” ngbk-focus>')($rootScope);
818820
}));
819821

820-
it('should have focus immediately', function() {
822+
it('should have focus immediately', function() {
821823
expect(elem.hasClass('focus')).toBeTruthy();
822824
});
823825
});
@@ -836,7 +838,7 @@ Yeoman不支持压缩文件, 但是根据来发者提供的信息, 它很快会
836838
值得庆幸的是, RequireJS的处理方式并不会影响我们所有的端到端的测试, 因此可以使用我们目前所看到的方式简单的做到这一点. 一个范例配置如下, 假设你的服务其在http://localhost:8000上运行你的应用程序:
837839
```js
838840
// base path, that will be used to resolve files
839-
// (in this case is the root of the project
841+
// (in this case is the root of the project
840842
basePath = '../';
841843

842844
// list of files / patterns to load in the browser
@@ -858,7 +860,7 @@ Yeoman不支持压缩文件, 但是根据来发者提供的信息, 它很快会
858860

859861
// cli runner port
860862
runnerPort = 9898;
861-
863+
862864
// enable/disable colors in the output (reporters and logs)
863865
colors = true;
864866

0 commit comments

Comments
 (0)