lundi 12 octobre 2015

Ember/emberfire run loop acceptance test

So my acceptance test keeps on destroying itself before my promise finishes. I'm aware that I need to wrap my promise in Ember run loop but I just can't get it to work. Here's how my component looks:

export default Ember.Component.extend({
  store: Ember.inject.service(),

  didReceiveAttrs() {
    this.handleSearchQueryChange();
  },

  /**
   * Search based on the searchQuery
   */
  handleSearchQueryChange() {
    this.get('store').query('animals', {
      orderBy: 'name',
      startAt: this.attrs.searchQuery
    }).then(searchResults => {
      this.set('searchResults', searchResults);
    });
  }
});

I've already tried wrapping this.handleSearchQueryChange(), this.get('store').query... and this.set('searchResults', searchResults) in a run loop but still, the acceptance test just doesn't wait for store.query to finish.

One thing to note that this store query performs a request on a live Firebase back-end.

Anyone care to provide a solution?




Aucun commentaire:

Enregistrer un commentaire