You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, I've been using RITEway a lot over the last two weeks and I love it, especially for TDD 👌🏻 But there where some edge cases where I wasted up to a couple of hours figuring out the selectors. I think others could save that time.
I'm wondering whether you would be open for an examples/ folder? If you are okay with it, I would include the following cases (for which I already have the code, except for the regex one):
1, Select multiple elements in a React component with the same class (useful for lists, tables).
2, Select input's vaules in a React component
3, Test whether selection is a certain tag (e.g. <button /> or <select /> etc.) in React Component.
4. Add context and dummy required props for propTypes in a React component. This would be in the createComponent factory function. E.g.:
// in the componentCounter.propTypes={onClick: PropTypes.func.isRequired}// ... in the testconstcreateCounter=clickCount=>render(<ClickCounterclicks={clickCount}onClick={()=>{}}/>);
Regex.
The reducer from your "Unit Testing React Components" article and adding tests for selectors.
I still have 3 questions about these:
Do you even recommend to use propTypes? If not, why not?
You said you would use regex like this: /search text/.test(renderedOutput). I couldn't figure out how you would use this. Could you give a more concrete example?
Is it correct that you would test selectors like this:
constgetCount=state=>state.counter;assert({given: 'a click count and a click action',should: 'add a click to the count',actual: getCount({counter: reducer(3,click())}),expected: 4});
If you could answer these questions and like the idea of an examples/ folder, I will make a PR asap 😊Also would you like to see another case?
The text was updated successfully, but these errors were encountered:
So, I've been using RITEway a lot over the last two weeks and I love it, especially for TDD 👌🏻 But there where some edge cases where I wasted up to a couple of hours figuring out the selectors. I think others could save that time.
I'm wondering whether you would be open for an
examples/
folder? If you are okay with it, I would include the following cases (for which I already have the code, except for the regex one):1, Select multiple elements in a React component with the same class (useful for lists, tables).
2, Select input's vaules in a React component
3, Test whether selection is a certain tag (e.g.
<button />
or<select />
etc.) in React Component.4. Add context and dummy required props for propTypes in a React component. This would be in the
createComponent
factory function. E.g.:I still have 3 questions about these:
/search text/.test(renderedOutput)
. I couldn't figure out how you would use this. Could you give a more concrete example?If you could answer these questions and like the idea of an
examples/
folder, I will make a PR asap 😊Also would you like to see another case?The text was updated successfully, but these errors were encountered: