-
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
Add support for component data-test-* attributes without values #55
Add support for component data-test-* attributes without values #55
Conversation
This adds support for `{{my-component data-test-foo}}`. Basically, this adds a handlebars transform that converts the previous example to `{{my-component data-test-foo=true}}`.
@@ -35,6 +35,14 @@ module.exports = { | |||
plugin: StripTestSelectorsTransform, | |||
baseDir: function() { return __dirname; } | |||
}); | |||
} else { | |||
var TransformTestSelectorParamsToHashPairs = require('./transform-test-selector-params-to-hash-pairs'); |
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.
I think? this is where this should be but I'm definitely not sure.
@HeroicEric nice work! there is one small caveat though, because you now can no longer pass a |
What will {{my-component data-test-foo=true}} actually render though? I'm thinking if it renders <div data-test-foo>… that's fine but if it renders <div data-test-foo="true">… we're adding additional complexity with this. |
it should render the first code block, but I'll verify that later. |
@marcoow seems to do exactly what we want: |
@HeroicEric there were two issues that caused the tests to fail:
|
Wohooo! Thanks @HeroicEric! |
released as |
Transforms
to:
Description
This adds support for
{{my-component data-test-foo}}
.Basically, this adds a handlebars transform that converts the previous example to
{{my-component data-test-foo=true}}
, which already works.I understand if you'd rather not accept this feature but I thought it might be nice since this style selector is supported for regular elements 😄
Use case:
The app I'm currently working on uses a lot of
<div data-test-foo>
style test selectors. I'd like to extract some of these elements into components but the current situation with the component support would require either coming up with values for each of thedata-test-*
attributes or usingdata-test-foo=true
throughout the app.