-
Notifications
You must be signed in to change notification settings - Fork 41
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
Strip test selectors defined in component javascript #10
Comments
We find it more convenient to have the data attributes in the templates as that also allows more flexibility since you can have data attributes on individual elements as well as opposed to only the component itself. Of course it would be nice to support this case as well though. Would be great if you could submit a PR implementing that although I'm not sure how this would best be done. |
It would probably also make sense to always (except for in production of course) add a |
I'm using this in a project now: // app/mixins/components/has-test-selector.js
import Ember from 'ember';
import ENV from '../../config/environment';
const { computed } = Ember;
const { getPrototypeOf } = Object;
let TestSelectorMixin;
if (ENV.environment !== 'production') {
TestSelectorMixin = Ember.Mixin.create({
attributeBindings: 'data-test-selector',
'data-test-selector': computed(function() {
return getPrototypeOf(this)._debugContainerKey.replace(/^component:/, '');
})
});
} else {
TestSelectorMixin = Ember.Mixin.create();
}
export default TestSelectorMixin; I guess sth. like this could be added to Of course |
@marcoow I like this idea. Would it make more sense if it were something a tad more descriptive like |
@chrisdpeters: yeah, sounds like a good idea. |
@marcoow any update on this? |
I'm hoping someone will find some time to do this soon. It would definitely be a great addition. Someone on our team might actually be able to pick this up in the next weeks but we've all been pretty busy lately. |
This has been fixed via #45 |
This is a great idea! However, many times I find myself doing something like this:
Just browsing the code, it looks like this wouldn't be stripped (since it's using a handlebars AST parser).
The text was updated successfully, but these errors were encountered: