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

Replace initializer with IIFE in the vendor tree #52

Merged
merged 1 commit into from
Jan 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,6 @@ Installation
ember install ember-test-selectors
```

When you install the addon, it should automatically generate a helper located at
`tests/helpers/test-selectors.js` as well as add an import to load that helper
in `tests/test-helper.js`. This sets up the component `data-test-*` auto-binding
for integration tests.

You can do this manually as well:

```
$ ember generate ember-test-selectors
```

Usage
------------------------------------------------------------------------------
Expand Down
16 changes: 0 additions & 16 deletions addon/initializers/ember-test-selectors.js

This file was deleted.

9 changes: 0 additions & 9 deletions app/.eslintrc.js

This file was deleted.

1 change: 0 additions & 1 deletion app/initializers/ember-test-selectors.js

This file was deleted.

11 changes: 0 additions & 11 deletions blueprints/.eslintrc.js

This file was deleted.

11 changes: 0 additions & 11 deletions blueprints/files/tests/helpers/test-selectors.js

This file was deleted.

17 changes: 0 additions & 17 deletions blueprints/index.js

This file was deleted.

11 changes: 4 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,16 @@ module.exports = {

this._registeredWithBabel = true;
}
},

treeForAddon: function() {
// remove our "addon" folder from the build if we're stripping test selectors
if (!this._stripTestSelectors) {
return this._super.treeForAddon.apply(this, arguments);
app.import('vendor/ember-test-selectors/patch-component.js');
}
},

treeForApp: function() {
// remove our "app" folder from the build if we're stripping test selectors
treeForAddon: function() {
// remove our "addon" folder from the build if we're stripping test selectors
if (!this._stripTestSelectors) {
return this._super.treeForApp.apply(this, arguments);
return this._super.treeForAddon.apply(this, arguments);
}
},

Expand Down
15 changes: 15 additions & 0 deletions vendor/ember-test-selectors/patch-component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* global Ember */

(function() {
var bindDataTestAttributes;

Ember.Component.reopen({
init: function() {
this._super.apply(this, arguments);
if (!bindDataTestAttributes) {
bindDataTestAttributes = require('ember-test-selectors/utils/bind-data-test-attributes')['default'];
}
bindDataTestAttributes(this);
}
});
})();