问题描述
翻翻角JS ,我不明白的地方中继器(功能?)来自于茉莉花测试。这是一个茉莉花或角度构造?
页面确实有一个NG重复属性的<李>
元素 - 但我没有看到如何,在测试中翻译的参照转发器
它('应该可以通过下拉选择框来控制电话订购,
功能(){
//让我们缩小数据集,使测试断言短
。输入(查询)进入('平板电脑'); //哪里中继下面从何而来?
期待(中继器('。电话里,电话列表)。列('phone.name'))。
toEqual([摩托罗拉XOOM \\ u2122具有Wi-Fi
摩托罗拉XOOM \\ u2122]); 选择('orderProp')选项(字母)。
期待(中继器('。电话里,电话列表)。列('phone.name'))。
toEqual([摩托罗拉Xoom \\ u2122
摩托罗拉XOOM \\ u2122具有Wi-Fi]);
});
的转发
不是茉莉花建设,这是AngularJS E2E方案测试的概念。
的转发
函数是由AngularJS E2E方案亚军使用的DSL定义,它的定义可以看这里:https://github.com/angular/angular.js/blob/master/src/ngScenario/dsl.js#L249
相应的文件位于:http://docs.angularjs.org/guide/dev_guide.e2e-testing
应当注意的是,即使AngularJS使用茉莉语法其端至端的测试,这些端到端测试的不的茉莉测试时,他们只是碰巧使用非常相似的语法。在AngularJS的目的 ngScenario
亚军是在浏览器中执行终端到终端的测试,使用的匹配紧张的浏览器环境(DOM,位置等)茉莉花更侧重于单元测试和对JavaScript对象的匹配。
所提到的转发
只是一个计数DOM对象给出一个jQuery选择器,并且通常用来计数由<$ C $产生的DOM元素它是真实的方式C> ngRepeat 指令。
Looking through angular js tutorial, I do not understand where the repeater (function?) comes from in a jasmine test. Is this a jasmine or an angular construct?
The page does have an ng-repeat attribute in a <li>
element - but I dont see how that translates to the reference to 'repeater' in the test
it('should be possible to control phone order via the drop down select box',
function() {
//let's narrow the dataset to make the test assertions shorter
input('query').enter('tablet');
//where does 'repeater' below come from?
expect(repeater('.phones li', 'Phone List').column('phone.name')).
toEqual(["Motorola XOOM\u2122 with Wi-Fi",
"MOTOROLA XOOM\u2122"]);
select('orderProp').option('Alphabetical');
expect(repeater('.phones li', 'Phone List').column('phone.name')).
toEqual(["MOTOROLA XOOM\u2122",
"Motorola XOOM\u2122 with Wi-Fi"]);
});
The repeater
is not a Jasmine construct, it is AngularJS e2e scenario tester concept.
The repeater
function is defined in the DSL used by the AngularJS e2e scenario runner and its definition can be seen here: https://github.com/angular/angular.js/blob/master/src/ngScenario/dsl.js#L249The corresponding documentation is located at: http://docs.angularjs.org/guide/dev_guide.e2e-testing
It should be noted that even if AngularJS uses Jasmine syntax for its end-to-end test, those e2e tests are not Jasmine tests, they just happen to use very similar syntax. The purpose of the AngularJS ngScenario
runner is to execute end-to-end tests in a browser and uses matchers are tight to the browser environment (DOM, location etc.) Jasmine is more focused on unit-tests and has matchers for JavaScript objects.
The mentioned repeater
is just a way of counting DOM object given a jQuery selector and it is true that is usually used to count DOM element produced by the ngRepeat
directive.
这篇关于在这个角度教程“中继”茉莉花概念?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!