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

Add tests #4

Merged
merged 1 commit into from
Mar 2, 2016
Merged

Add tests #4

merged 1 commit into from
Mar 2, 2016

Conversation

pangratz
Copy link
Contributor

@pangratz pangratz commented Mar 2, 2016

This adds basic tests for the HTMLBars plugin using the existing ember-cli infrastructure. The plugin is added to the dummy apps' registry so all data-test-* attributes within the dummy app are stripped. Then a normal moduleForComponent integration test adds assertions for successfully stripped attributes.

Since the plugin itself is not located within app/ or tests/, the mocha JSHint test suite is setup to check for styling issues within the plugin.

ember-try is configured to run the tests using ember 1.13 and canary, beta as well as release channels.


The functionality of the HTMLBars plugin itself is fully tested now. One thing that still bugs me is that there is no test for the addon itself: since it adds the plugin only in the production environment, it would be nice to have a smoke test which basically does the following:

ember new smoke-test-app
cd smoke-test-app
ember install ember-test-selectors
echo "<span data-test-id='my-id' ></span>" > app/templates/application.hbs
ember build --prod
# assert that the served application doesn't contain the `data-test-id` attribute

I am not sure how this would be achieved yet, so this is still missing 😢

Closes #1

@marcoow
Copy link
Member

marcoow commented Mar 2, 2016

Yay, looks great! I think not having the activation tested is fine. At least the tests already test that the activation mechanism that we use works (https://github.com/simplabs/ember-test-selectors/pull/4/files#diff-2fe2a7faee7de1e0d5d82e032498d84cR14), we just don't have the specific lines in index.js covered.

The plugin is added to the dummy apps build pipeline so all
`data-test-*` attributes are stripped within that app.

This allows us to re-use the existing EmberCLI testing infrastructure to
test the HTMLBars plugin.
marcoow added a commit that referenced this pull request Mar 2, 2016
@marcoow marcoow merged commit 7c917ff into master Mar 2, 2016
@marcoow marcoow deleted the add-tests branch March 2, 2016 10:32
@pangratz
Copy link
Contributor Author

pangratz commented Mar 2, 2016

👯

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

Successfully merging this pull request may close these issues.

3 participants