Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Polymer 聚合物网组件测试仪_Polymer_Web Component Tester - Fatal编程技术网

Polymer 聚合物网组件测试仪

Polymer 聚合物网组件测试仪,polymer,web-component-tester,Polymer,Web Component Tester,是否有一种方法可以使用web component tester将键发送到输入字段?我想测试将返回键发送到表单。我不知道Web组件测试仪中有这样的方法,但Polymer的MockInteractions可以。它甚至有一个专门用于ENTER: 安装 用法 描述(‘可访问性’、功能(完成){ 它('按ENTER键应跳转到下一页',函数(){ var el=固定装置(“基本”); var expectedIndex=el.pageIndex+1; 模拟交互。按Enter键(el.$.nextBtn);

是否有一种方法可以使用web component tester将键发送到输入字段?我想测试将返回键发送到表单。

我不知道Web组件测试仪中有这样的方法,但Polymer的
MockInteractions
可以。它甚至有一个专门用于ENTER:

安装 用法

描述(‘可访问性’、功能(完成){
它('按ENTER键应跳转到下一页',函数(){
var el=固定装置(“基本”);
var expectedIndex=el.pageIndex+1;
模拟交互。按Enter键(el.$.nextBtn);
//按ENTER()模拟按键向下和异步按键向上,
//因此,在测试结果之前,请等待一段时间
setTimeout(函数(){
expect(el.pageIndex).to.be.eql(expectedIndex);
完成();
}, 500);
});
});
bower i --save-dev iron-test-helpers
<link rel="import" href="iron-test-helpers/iron-test-helpers.html">

<script>
  describe('accessibility', function(done) {
    it('should jump to next page on ENTER key', function() {
      var el = fixture('basic');
      var expectedIndex = el.pageIndex + 1;

      MockInteractions.pressEnter(el.$.nextBtn);

      // pressEnter() simulates key-down and asynchronous key-up,
      // so wait a while before testing the result
      setTimeout(function() {
        expect(el.pageIndex).to.be.eql(expectedIndex);
        done();
      }, 500);
    });
  });
</script>