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

Fill input in acceptance tests #2

Open
lan0 opened this issue Apr 6, 2016 · 2 comments
Open

Fill input in acceptance tests #2

lan0 opened this issue Apr 6, 2016 · 2 comments

Comments

@lan0
Copy link

lan0 commented Apr 6, 2016

The fillIn helper does not seem to work for this component.

Am I doing something wrong or is there any other way I could fill out the input in acceptance tests?

@lan0
Copy link
Author

lan0 commented Apr 6, 2016

I've wrote this little test helper to fill out the input after digging around in the source a little bit:

import Ember from 'ember';

export default Ember.Test.registerAsyncHelper('fillTime', function(app, selector, string) {
  const $element = find(selector);
  Ember.run(() => {
    $element.focusin();
    for (let i = 0, length = string.length; i < length; i++) {
      const e = Ember.$.Event('keydown', {
        keyCode: string.charCodeAt(i),
      });
      $element.trigger(e);
    }
    $element.focusout();
  });
});

@williamweckl
Copy link

You can use typeIn instead of fillIn.

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