Skip to content

Commit

Permalink
Merge pull request #764 from Turbo87/auto-binding
Browse files Browse the repository at this point in the history
Remove deprecated automatic attribute binding
  • Loading branch information
Turbo87 authored Jul 5, 2021
2 parents fceb25a + 63f7e49 commit dc2ed07
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 400 deletions.
17 changes: 0 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ Features
- Removes properties starting with `data-test-` from your JS objects like
component classes for production builds

- Automatically binds properties starting with `data-test-` on all components
for development/testing builds

More information on why that is useful are available on our
[blog](http://simplabs.com/blog/2016/03/04/ember-test-selectors.html)!

Expand Down Expand Up @@ -79,20 +76,6 @@ be applied to the element that has `...attributes` on it, or on the component
wrapper `div` element if you don't use `tagName = ''`.


### Usage with Curly Components

If you still use the old curly invocation syntax for components you can pass
`data-test-*` arguments to the components and they will automatically be bound
on the wrapper element too:

```handlebars
{{spinner color="blue" data-test-spinner=true}}
```

Please note that the automatic argument binding only works for components based
on `@ember/component`, but not `@glimmer/component`.


### Usage in Ember addons

If you want to use ember-test-selectors in an addon make sure that it appears
Expand Down
79 changes: 0 additions & 79 deletions addon/utils/bind-data-test-attributes.js

This file was deleted.

16 changes: 4 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ module.exports = {
this._stripTestSelectors = !app.tests;
}

this._shouldPatchClassicComponent = !this._stripTestSelectors && addonOptions.patchClassicComponent !== false;
if ('patchClassicComponent' in addonOptions) {
ui.writeDeprecateLine('[ember-test-selectors] The `patchClassicComponent` option is obsolete. ' +
'You can remove it from your `ember-cli-build.js` file.', false);
}
},

_setupPreprocessorRegistry(registry) {
Expand Down Expand Up @@ -70,10 +73,6 @@ module.exports = {

this._registeredWithBabel = true;
}

if (this._shouldPatchClassicComponent) {
host.import('vendor/ember-test-selectors/patch-component.js');
}
},

cacheKeyForTree(treeType) {
Expand All @@ -85,13 +84,6 @@ module.exports = {
}
},

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

preprocessTree(type, tree) {
// remove the unit tests if we're testing ourself and are in strip mode.
// we do this because these tests depend on the "addon" and "app" folders being available,
Expand Down
66 changes: 0 additions & 66 deletions tests/acceptance/bind-data-test-attributes-in-components-test.js

This file was deleted.

21 changes: 0 additions & 21 deletions tests/dummy/app/templates/bind-test.hbs

This file was deleted.

Loading

0 comments on commit dc2ed07

Please sign in to comment.