-
Notifications
You must be signed in to change notification settings - Fork 18
Break up the render method logic into functions #1148
Conversation
el-mapache
commented
Jun 30, 2017
•
edited
Loading
edited
- Adds two components to represent a link and button.
- Removes nested if/else statements in favor of smaller named functions
4c60604
to
5cd9f0d
Compare
Great idea @el-mapache! Looking much cleaner |
5b50290
to
e0a8a4c
Compare
Thanks! I'm hoping to hit up a couple more spots in the code this week as well. |
e0a8a4c
to
d79e326
Compare
@jcscottiii @rememberlenny I commented out one of the specs that tests that the click handler is called from the child component of . I can't get it to pass, although manual testing verifies that it works. If ya'll have any ideas for why it might be failing, they would be much appreciated. |
expect(clickHandlerSpy).toHaveBeenCalledOnce(); | ||
}); | ||
xit('triggers clickHandler', () => { | ||
action.find(Button).simulate('click'); |
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.
Can't think of why this wouldn't work besides that it's a simulated click. But even then, there's an exact example in the enzyme docs with sinon, pretty much just like this.
I wouldn't say this is the most important thing to test as I don't think there are any logic branches in the functionality that calls the click handler
I switched to using Was looking at this when I decided to make the change: https://github.com/airbnb/enzyme#full-dom-rendering |
|
@jcscottiii is this good to be merged? |
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 looks good! Just need to rebase / fix conflicts
* Adds two components to represent a link and button. * Removes nested if/else statements in favor of smalled named functions Rename folder, trying to get all the specs passing
5c53988
to
87a89b0
Compare
@jcscottiii All updated! |
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.
one last thing. there's that skipped test.
one more thing, can we use |
The shallowly rendered component wasn't registering click events