Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

Updates to React 16 #231

Merged
merged 10 commits into from
Nov 15, 2017
Merged

Updates to React 16 #231

merged 10 commits into from
Nov 15, 2017

Conversation

mAiNiNfEcTiOn
Copy link
Contributor

What does this PR do:

  • Updates react and its related packages to minimum version of 16.1.0.
  • Replaces enzyme-adapter-react-15 with enzyme-adapter-react-16 both in package.json and tests/setupTests.js.
  • Updates jest to `21.3.0-betaª to get a fix for the rAF warning (see more at: Add simple rAF polyfill in jsdom environment jestjs/jest#4568 (comment) )
  • Adds the import of the rAF polyfill, via raf package, replacing the existing one.
  • Changes the components to replace the usage of <noscript /> for null.
  • Updates the tests to validate against the renderTree.html()'s result and also removes the usage of React.PropTypes in favour of prop-types one.
  • Updates snapshots.

Where should the reviewer start:

  • Diffs
  • Check the styleguide result.

@mAiNiNfEcTiOn mAiNiNfEcTiOn requested review from a team November 15, 2017 10:44
@mAiNiNfEcTiOn mAiNiNfEcTiOn self-assigned this Nov 15, 2017
@@ -53,7 +53,7 @@ exports[`Badge should return content inside container if title not provided 1`]
</div>
`;

exports[`Badge should return noscript if children and title not provided 1`] = `<noscript />`;
exports[`Badge should return noscript if children and title not provided 1`] = `""`;
Copy link
Contributor

Choose a reason for hiding this comment

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

You could test return null cases without snapshot. Just do this: expect(component.type()).toEqual(null);

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I see you changed that. So that way should work here as well, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added assertion to verify that it returns null.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool, thanks! ...but do we still really need to compare to snapshot? I would suggest to not create snapshots in these cases and just check the type()/html(). How do you think guys?

Copy link
Contributor Author

@mAiNiNfEcTiOn mAiNiNfEcTiOn Nov 15, 2017

Choose a reason for hiding this comment

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

Strangely, the type() did not work... Don't know why, though.

Regarding the comparison to the snapshot... Well, for the null cases I guess no.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

@@ -39,6 +40,6 @@ export default class CalendarWrapper extends React.Component {
}

CalendarWrapper.propTypes = {
initialDates: React.PropTypes.arrayOf(String),
minDate: React.PropTypes.string,
initialDates: PropTypes.arrayOf(String),
Copy link
Contributor

Choose a reason for hiding this comment

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

Not part of your changes but this can't be right, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean the fact that we have propTypes on a wrapper/mock or the fact that I ordered the propTypes?

Copy link
Contributor

Choose a reason for hiding this comment

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

arrayOf(String) should be arrayOf(PropTypes.string). The first one will basically accept an array of truthy values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@reaktivo I think the arrayOf receives the Constructor/Type. How would you do with a custom class/Component? PropTypes.MyComponent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh screw it, I do think this is supported, but anyway... Changing 🙄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now I got it... It's not a PropType checker... just a constructor ... I thought the arrayOf would do (internally) value instanceof ConstructorThatWasPassedInTheArrayOf.

@codecov
Copy link

codecov bot commented Nov 15, 2017

Codecov Report

Merging #231 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #231   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          41     41           
  Lines        1051   1051           
  Branches      261    261           
=====================================
  Hits         1051   1051
Impacted Files Coverage Δ
components/price/price.js 100% <100%> (ø) ⬆️
components/button/button.js 100% <100%> (ø) ⬆️
components/slidingPanel/slidingPanelHeader.js 100% <100%> (ø) ⬆️
components/badge/badge.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 53acd56...4146b3e. Read the comment docs.

Ricardo Machado added 6 commits November 15, 2017 14:29
…Replaces enzyme-adapter-react-15 with enzyme-adapter-react-16. Updates Jest to 21.3.0-beta to get a fix for the rAF warning
…places the usage of enzyme-adapter-react-15 for enzyme-adapter-react-16
… Updates snapshots. Removes the usage of React.PropTypes in favour of 'prop-types' one
@mAiNiNfEcTiOn mAiNiNfEcTiOn merged commit 8a1e485 into master Nov 15, 2017
@yurist38
Copy link
Contributor

@mAiNiNfEcTiOn should we delete branch?

@leandrooriente leandrooriente deleted the update-react-16 branch March 6, 2018 09:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants