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

Clicking an async-button in QUnit test does not work but works fine with HTML button #85

Open
jackmatt2 opened this issue Mar 30, 2016 · 1 comment

Comments

@jackmatt2
Copy link

I have the following test which is trying to click a button is inside a modal.

  const selector = `button:contains("${buttonText}"), a:contains("${buttonText}")`;
  const found = find(selector, Ember.$('body'));
  assert.equal(1, found.length, `Should find the button or link with text "${buttonText}"`);
  click(selector, Ember.$('body'));  <--------- button click
  found.click();  <--------------- does not work either

In the modal I have tried the following button types.

  // (FAIL) If the button is an async button it does not fire the action at all
  {{async-button class="btn btn-primary" type="button" action=(route-action 'save' model) default="Proceed" pending="Saving..."}}

  // (SUCCESS) The same test but using a regular button and the action is fired
  <button class="btn btn-primary" type="button" onclick={{route-action 'save' model}}>Proceed</button>

The button click fires without any errors in both cases so it is not like the button is not found.

The reason for passing a context to click and find is that without it QUnit was unable to find the control as it is rendered inside the application template.

@ghost
Copy link

ghost commented Aug 23, 2016

This is probably a problem with ember-tether, can you confirm? @jackmatt2

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

1 participant