-
Notifications
You must be signed in to change notification settings - Fork 10
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 support for data-test-* properties #70
base: master
Are you sure you want to change the base?
Conversation
When these are set to boolean true they are added to the element, boolean false are skipped (can't think of why these would exist) When they are set to a literal value that value is used. Anything else throws.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jrjohnson thanks for the PR. similar to the ember-component-css
code we have, could you add a check that only enables this transform if the app has a ember-test-selectors
dependency? 🙏
@Turbo87 ✔️ |
@@ -125,6 +127,9 @@ module.exports = function transformClassicComponent(root, options) { | |||
let classNameBindings = findClassNameBindings(properties); | |||
debug('classNameBindings: %o', classNameBindings); | |||
|
|||
let dataTestAttributes = findDataTestAttributes(properties); | |||
debug('dataTestAttributes: %o', dataTestAttributes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, instead of creating a dedicated thing here, I'm wondering if it would be easier to just add all the data-test-*
properties to the attribute bindings? that's what ember-test-selectors does internally and it would also support computed properties that way. I'm just not sure if data-test-foo={{this.data-test-foo}}
is valid code due to the -
in the property name 🤔
When these are set to boolean true they are added to the element,
boolean false are skipped (can't think of why these would exist)
When they are set to a literal value that value is used.
Anything else throws.
I only handled classic components because I'm not sure if setting properties like this works on classes. If that's a working case let me know and I'll add it.
Fixes #34