learning code
learning code

Reputation: 21

how to test ajax request in custom component made by polymer

component html file part where request is being send

       <paper-button class="indigo" style="margin-top:1em; width:15%" 
        on-tap="sendLoginRequest">Login</paper-button>
         <iron-ajax id="loginAjaxRequest" handle-as="json" on- 
     response="loginResponse" on-error="showToast"></iron-ajax>

sendloginRequest function part where request is fired

        sendLoginRequest() {
         //some code
   this.$.loginAjaxRequest.url = "http://localhost:8080/api/login"
    this.$.loginAjaxRequest.body = JSON.stringify(loginJson)
    this.$.loginAjaxRequest.method = "POST"
    this.$.loginAjaxRequest.generateRequest()
  }

how to write test cases for it

Upvotes: 0

Views: 92

Answers (0)

Related Questions