Skip to content
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

Async method selector resolves immediately #148

Closed
danfinlay opened this issue Mar 5, 2015 · 8 comments
Closed

Async method selector resolves immediately #148

danfinlay opened this issue Mar 5, 2015 · 8 comments

Comments

@danfinlay
Copy link

Seem to have revealed a weird behavior regarding async helper selector resolution order. Not sure if I'm observing this right, but this is what it seems:

If I have a button that reveals another button, let's say something like:

<button class="reveal" {{action 'revealOtherButton'}}>Reveal!</button>
{{#if isRevealed}}
  <button class="special" {{action 'doImportantThings'}}>Do it!</button>
{{/if}}

And in my tests I say

click('.reveal');
click('.special');

I get an error, that .special was not found.

However, if I wrap that second click in an andThen helper, it works.

click('.reveal');
andThen(function(){
  click('.special');
});

This implies to me that the selectors are resolved immediately, while the actions are resolved asynchronously. This seems wrong to me. I would expect the selectors to resolve as part of the async action, so I can click a selector that isn't revealed yet, as long as it's after an async helper that would reveal it.

Am I reading this right? Is this deliberate behavior? If so, I would argue it's wrong.

@stefanpenner
Copy link
Member

the async that is caused by click is likely not handled by the route.

@danfinlay
Copy link
Author

You're right, it's handled by the controller. Are you saying that the async helpers only wait for route-level async actions?

@danfinlay
Copy link
Author

I thought they just wait for the run loop to empty, so any Ember-run managed async action. I thought this included any controller async actions.

Is there a good reason for this? Why not wait for controller-level async?

@stefanpenner
Copy link
Member

ou're right, it's handled by the controller. Are you saying that the async helpers only wait for route-level async actions?

correct.

@stefanpenner
Copy link
Member

this also isn't part of ember-qunit rather ember-testing

@danfinlay
Copy link
Author

But why not just wait for the full run loop's completion, including actions?

@danfinlay
Copy link
Author

where is the ember-testing repo?

@stefanpenner
Copy link
Member

@FlySwatter its part of ember

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants