vendredi 15 janvier 2016

EmberJS Qunit "change" event doesn't fire and throws an error

I have some problem with EmberJS 2.2.0 and Qunit.

There is acceptance test with some jquery

test('some test', function(assert) {
  visit('/some-route/new');

  andThen(function() {
    var option = this.$('#some-select option:eq(1)');
    this.$('#some-select').val(option.val());
  });

  andThen(function() {
    this.$('#some-select').trigger('change');
  });

  andThen(function() {
    var selected = this.$('#some-select option:selected').val();
    assert.equal(selected, 1);
  });

  andThen(function() {
    assert.equal(this.$('#some-select option:selected').val(), 1);

    andThen(function() {
      assert.equal(this.$('.some-field :input').val(), 100);
    });
  });
});

Here's problem.

When I use .trigger('change') or .change() tests fail and throw Adapter operation failed. In console it log undefined and test fails. How can I fire this event? I have some logic based on changing of select's value.




Aucun commentaire:

Enregistrer un commentaire