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

Expose test helpers for component unit tests #3

Closed
cbrock opened this issue Nov 5, 2014 · 3 comments
Closed

Expose test helpers for component unit tests #3

cbrock opened this issue Nov 5, 2014 · 3 comments

Comments

@cbrock
Copy link

cbrock commented Nov 5, 2014

In ember-cli, test helpers are made available for integration tests by calling startApp(). Ember test helpers are not available for unit tests, nor is it appropriate to call startApp() within a unit test.

However, because unit tests for Ember components rely on the component being tested to exist as part of the DOM, a subset of test helper methods are actually useful in that context - for example, fillIn() or find() (conversely, other test helpers like visit() still do not make sense in the context of a component unit test).

It would be useful to expose an appropriate subset of DOM-related test helpers, scoped to the component being tested (e.g. this.fillIn('selector', 'value'), since the component being tested exists as part of the DOM.

@jeremywrowe
Copy link

I hate bumping issues because I realize everyone is really busy. But I think this still makes a lot of sense; especially with the recently added { integration: true } for components. I've done some looking around but haven't rolled over the correct rock yet. If I could be pointed in the right direction, i'd be happy to open a pull request. (if it is feasible)

@spinlock99
Copy link

I'm having a similar issue where I have a custom helper that I'd like to expose in my unit tests. It would be very helpful to not have to register it in every file.

@rwjblue
Copy link
Member

rwjblue commented Oct 14, 2017

The easiest way to get these helpers immediately is by using the ember-native-dom-helpers addon. In a future iteration (after another testing RFC) ember-test-helpers will provide them directly...

@rwjblue rwjblue closed this as completed Oct 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants