Skip to content
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

feat(ffe-form-react): Pass refs for input and textarea #265

Closed
wants to merge 2 commits into from

Conversation

selbekk
Copy link
Contributor

@selbekk selbekk commented May 31, 2018

BREAKING CHANGE: Requires React 16.4.0 and above!

This commit lets the consumer pass refs down to the Input and
TextArea components, to handle focus et al.

The only breaking change is the fact that React 16.4.0 is required.

This commit also disables two test suites, since Enzyme doesn't yet support
React's newest versions. For more information, please refer to this
issue:

enzymejs/enzyme#1513

The support sounds like they're right around the corner it's awaiting a release), but I think this PR could be reviewed (and perhaps merged) before enzyme get their stuff together.

Fixes #231.

@coveralls
Copy link

coveralls commented May 31, 2018

Coverage Status

Coverage decreased (-1.8%) to 78.273% when pulling 6361636 on 231-use-forwardRef into c75ac45 on develop.

"react-motion": "^0.5.2",
"react-test-renderer": "^16.2.0",
"sinon": "^4.2.1"
},
"peerDependencies": {
"@sb1/ffe-core": "^12.0.0",
"@sb1/ffe-form": "^9.0.0",
"react": "^16.2.0"
"react": "^16.3.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should mirror the devDependencies version since consumers will actually need 16.4.x

@@ -22,6 +25,15 @@ describe('<Input />', () => {
expect(wrapper.hasClass('ffe-input-field')).toBe(true);
});

it('passes refs', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe expand the description here with why this is needed? Future Developer should be happy with not having to search through the Git log 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, it's a feature / quirk of React - not sure if I want to go around and explain all of those. I'll add a comment, sure, but I don't think it's needed in a general sense.

@wkillerud
Copy link
Contributor

We can make an exception with regards to the code coverage (use admin privileges), but I'd like it if this could wait until next week in case Enzyme is updated. Un-skipping these tests is one of those things that is quickly postponed and/or forgotten.

@henrikhermansen
Copy link
Contributor

I agree it's nice to keep up with news from React, but I also agree it's better to hold it off until Enzyme is ready to keep up. Although this probably isn't breaking any code, it would be nice to actually verify it with the tests before merging.

@selbekk
Copy link
Contributor Author

selbekk commented Jun 4, 2018

I could solve this a different (and non-breaking way) by letting the user pass in an innerRef or inputRef prop instead of using the actual ref prop. It would (could) lead to a breaking change in the future, but it could be combined with updating the React dependency,

What do you think - is that a better approach perhaps?

@ivarni
Copy link
Contributor

ivarni commented Jun 4, 2018

It seems like a lot of extra work just for some tests..

@henrikhermansen
Copy link
Contributor

@ivarni I'm confused about which path you're suggesting we take here 😄
@selbekk I think that might be a better choice, for now. But I don't feel strongly about either way.

@ivarni
Copy link
Contributor

ivarni commented Jun 6, 2018

I'm saying I don't think we should create an API with the intention of breaking it later just over some test library that isn't updated yet.
I'd say either disable those tests and go for the API we want or, if noone is dying to get this functionality, leave the PR open untill enzyme gets updated, but then leave the issue open so we don't forgettaboutit.

BREAKING CHANGE: Requires React 16.4.0 and above!

This commit lets the consumer pass refs down to the `Input` and
`TextArea` components, to handle focus et al.

The only breaking change is the fact that React 16.4.0 is required.

This commit also disables two test suites, since Enzyme doesn't yet support
React's newest versions. For more information, please refer to this
issue:

Fixes #231.
@selbekk selbekk force-pushed the 231-use-forwardRef branch from 168b8e1 to 6361636 Compare June 6, 2018 09:29
@selbekk
Copy link
Contributor Author

selbekk commented Oct 2, 2018

Closing this in favor of a new branch (this one got stale).

@selbekk selbekk closed this Oct 2, 2018
@selbekk selbekk deleted the 231-use-forwardRef branch October 2, 2018 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants