3

I have a custom polymer element which creates another polymer element in its properties. The code is as such :

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;
    }
  }
},

Now I am trying to test this page with WCT. The code for the same :

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

And I have a very basic corresponding test case. However, all tests fail with the following error :

Tests failed: Error thrown outside of test function: Cannot read property 'querystring' of undefined

Where/what exactly am I doing wrong? Unable to pin point. Please help!

0 Answers0