samedi 8 avril 2017

Ember integration test fails after click event

I have this integration test:

test('can change chord text', function(assert) {
  this.render(hbs``);
  this.$().click();
  assert.ok(!!this.$('.chord-input').length);
});

but the assertion fails, the component template looks like this:

<div  class="measure-chord chord-big">
    
        <input type="text" value="" class="chord-input">
    
        
    
</div>

and the component code:

import Ember from 'ember';

export default Ember.Component.extend({
  store: Ember.inject.service(),
  actions: {
    changeChord() {
        this.chord.set('editing', true);
    }
  }
});

I'm updating the chord model in the changeChord() action and it does work if I test in the browser, but the integration test fails. So, does this change in the model have to be rendered synchronously to the template? I tried using wait() in the test but that doesn't make a difference. So how should I test this?




Aucun commentaire:

Enregistrer un commentaire