I have following controller
MyController = Ember.Controller.extend({
actions: {
doSomething: function(param1, param2) {
this.send('actionName', param1, param2);
}
}
});
Is there a way to write an unit test that verifies that this controller will bubble up this action?
Specify target
of your subject (controller) and let your target
have actionName
declared in actions
object:
import { moduleFor, test } from 'ember-qunit';
moduleFor('controller:my-controller');
test('it fires an action', function(assert) {
let controller = this.subject();
controller.set('target', Ember.Controller.extend({
actions: {
actionName: () => assert.ok(true, 'Action bubbled!')
}
}).create());
controller.send('doSomething');
});