mardi 1 décembre 2015

Acceptance Test with Google Place Autocomplete

I am trying to write an acceptance test with Ember and Google Place Autocomplete library (http://ift.tt/1S0ivhf).

The typical flow would involve a user typing a few letters and then clicking on the autocomplete dropdown. The issue I am running into is that in my test, I am just filling in the text and never clicking on any dropdown so validation callbacks never get called.

My component:

{{address-autocomplete-field id='input-autocomplete' inputClass="form-control address" placeholder="Street, City, State and Zip Code" placeChangedCallback='addressChanged' value=address.address handlerController=this}}

I want to trigger placeChangedCallback which would call addressChanged from the actual component.

In my test, I have the following:

test('I can submit the form and move to employment', function(assert) {   

  visit('/onboarding/residence');

  fillIn('input.address', '123 Fake Street, Fake, CA, United States'); 

  andThen(function(){
    //The next statement is wrong, how do I trigger the correct callback?
    triggerEvent('input.address', 'addressChanged');
  });
}

How do I trigger the callback?




Aucun commentaire:

Enregistrer un commentaire