Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/365.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
Javascript WCT脚本未通过外部测试,带有:';在测试函数';_Javascript_Polymer_Mocha.js_Web Component Tester_Wct - Fatal编程技术网

Javascript WCT脚本未通过外部测试,带有:';在测试函数';

Javascript WCT脚本未通过外部测试,带有:';在测试函数';,javascript,polymer,mocha.js,web-component-tester,wct,Javascript,Polymer,Mocha.js,Web Component Tester,Wct,我有一个自定义的聚合物元素,它在其属性中创建了另一个聚合物元素。守则如下: Polymer({ is: 'pg-create-ad-new', properties:{ creative: { type: "String" }, storyId: { type: "String", value: ()=>{ var storyIdRegEx = /.*(storyId=(.+))/i, storyId = '';

我有一个自定义的聚合物元素,它在其属性中创建了另一个聚合物元素。守则如下:

Polymer({
is: 'pg-create-ad-new',

properties:{
  creative: {
    type: "String"
  },

  storyId: {
    type: "String",
    value: ()=>{
      var storyIdRegEx = /.*(storyId=(.+))/i,
          storyId = '';
        var context = document.createElement('page-router').getContext();
        var matches = storyIdRegEx.exec(context.querystring);  

      if(matches){
        storyId = matches[2];
      }
      return storyId;
    }
  }
},
现在我正试图用WCT测试这个页面。相同的代码:

<test-fixture id="createNewFixture">
    <template>
        <pg-create-ad-new>
        </pg-create-ad-new>
    </template>
</test-fixture>

我有一个非常基本的对应测试用例。但是,所有测试都会失败,并出现以下错误:

测试失败:在测试函数外部引发错误:无法读取未定义的属性“querystring”

我到底做错了什么?无法锁定该点。请帮忙