-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Click test helper doesn't fire .on('click') handlers #10495
Comments
I also tried replacing |
This test passes: var application;
moduleForComponent('increment-button', {
beforeEach: function() {
application = startApp();
},
afterEach: function() {
Ember.run(application, 'destroy');
application = null;
}
});
test('it works', function(assert) {
assert.expect(2);
var component = this.subject();
this.render();
assert.equal(component.get('count'), 0, 'Count is 0 before clicking');
click('button');
andThen(function() {
assert.equal(component.get('count'), 1, 'Count is 1 after clicking');
});
}); Moving the call to It seems to me like any bug here is not with ember, but with the ember test helpers. As an aside, it feels a bit strange to start an app like this for a component test, and I see some people agree with that - here's an issue: emberjs/ember-test-helpers#3 |
@kimroen great research!
I agree, though I don't know how else to test the behavior of event handlers. I suspect the app-start is required to set up Ember's (global) event dispatcher. |
@jamesarosen why are you booting up the app to test the component? |
I don't care about the app booting. I care about the test helpers like |
@jamesarosen so, to clarify, this doesn't work if you don't boot the app? |
I don't think booting the app should be a requirement for testing components, so if it is, that seems like a bug to me. |
@wagenet - The helpers that are needed here are specifically added to window when calling |
I came over this today - we do actually recommend doing it this way in the guide for testing components:
|
This is being addressed by emberjs/rfcs#119. Please track progress over there.... |
I have a component:
I'm trying to write a test for it:
The test fails with
0 !== 1
. I added aconsole.log
statement to_increment
and found that it never gets called.The text was updated successfully, but these errors were encountered: