-
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
Deprecate testSelector() helper #134
Conversation
find(testSelector('post-title')) // => find('[data-test-post-title]') | ||
find(testSelector('resource-id', '2')) // => find('[data-test-resource-id="2"]') | ||
find('[data-test-post-title]') | ||
find('[data-test-resource-id="2"]') |
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.
This diff is actually the perfect explanation of why I think the helper was a bad idea in the first place ;)
README.md
Outdated
Once you've done that you can use the `testSelector()` function to create | ||
a CSS/jQuery selector that looks up the right elements: | ||
Once you've done that you can use an attribute selectors to look up the | ||
elements: |
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.
no an
addon/index.js
Outdated
const { isNone, deprecate } = Ember; | ||
|
||
const message = `Using the "testSelector" helper function is deprecated as it obfuscates the selectors, making the tests harder to follow. | ||
Please write the actual abbribute selectors you need instead, e.g. "[data-test-my-element]" instead of "testSelector('my-element')".`; |
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.
abbribute
sounds like a funny little thing 😜
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.
Please use
instead of Please write
sounds better IMHO
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.
😞
17c3cb2
to
a9713c8
Compare
@Turbo87: fixed the surprisingly large amount of typos ;) |
@ryanto the function is/was essentially just a one liner, so it should be reasonable to just import it in your codebase as a test helper module |
I wrote a codemod to transform code to the new style. Hope it's helpful :-) |
This deprecates the
testSelector
helper and propagates using the respective attribute selectors directly instead. Besides obfuscating what's going on, thetestSelector
helper doesn't really do much.