Skip to content

Commit

Permalink
Replace initializer with IIFE in the vendor tree (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 authored Jan 17, 2017
1 parent eb9ce87 commit 62070d2
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 82 deletions.
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);
}
});
})();

0 comments on commit 62070d2

Please sign in to comment.