Skip to content

Conversation

@jrjohnson
Copy link
Contributor

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

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.
Copy link
Contributor

@Turbo87 Turbo87 left a 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 Turbo87 added the enhancement New feature or request label Mar 30, 2020
@jrjohnson
Copy link
Contributor Author

@Turbo87 ✔️

debug('classNameBindings: %o', classNameBindings);

let dataTestAttributes = findDataTestAttributes(properties);
debug('dataTestAttributes: %o', dataTestAttributes);
Copy link
Contributor

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 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for data-test-* properties on the JS class

2 participants