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

update test dependencies, resolve deprecations #1088

Merged
merged 9 commits into from
May 18, 2017
Merged

Conversation

giladgray
Copy link
Contributor

@giladgray giladgray commented May 11, 2017

Fixes #781

Changes proposed in this pull request:

  • I noticed a lot of deprecation warnings in our tests. Scroll through the "gulp test" section of a recent build of master (after cutting 1.17.0 with a clean cache). The following lines are everywhere:
    image
  • this PR resolves most of the warnings throughout our test suites, mainly by switching to react-test-renderer (another of those React 16 migration things) and updating enzyme to leverage it
  • a few test code tweaks were also necessary to resolve some deprecation warnings from our own code base!

Gilad Gray added 4 commits May 10, 2017 19:54
Remove react-addons-test-utils since it now lives at
react-dom/test-utils
Update relevant types & usage
pretty much just string replaces and a quick auto-format
@blueprint-bot
Copy link

Sort isotest components so the list is easier to scan

Preview: documentation | table
Coverage: core | datetime

@@ -29,7 +29,7 @@ function isReactClass(Component) {
* @param skipList {string[]} array of component names to skip
*/
module.exports = function generateIsomorphicTests(Components, props, children, skipList = []) {
Object.keys(Components).forEach((componentName) => {
Object.keys(Components).sort().forEach((componentName) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Reasoning here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

from commit message:

Sort isotest components so the list is easier to scan

makes it easier to immediately identify if a component is missing from the list

import { Classes, ITreeNode, ITreeProps, Tree } from "../../src/index";

/* tslint:disable:object-literal-sort-keys */
Copy link
Contributor

Choose a reason for hiding this comment

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

Any idea why this was here originally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, possibly something that was fixed in TSLint

@giladgray
Copy link
Contributor Author

went through the latest build here and resolved all outstanding warnings. the only remaining ones should be expected (from tests for deprecated props or Tabs component).

assert.strictEqual(timePicker.prop("precision"), TimePickerPrecision.SECOND);
// assert TimePicker disappears in absence of prop
wrapper.setProps({ timePrecision: undefined });
assert.isTrue(wrapper.find(TimePicker).isEmpty());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

WARN: 'Enzyme::Deprecated method isEmpty() called, use exists() instead.'

@@ -396,7 +396,7 @@ describe("<Popover>", () => {

wrapper.simulateTarget("click").assertIsOpen();

TestUtils.Simulate.click(document.getElementsByClassName(Classes.POPOVER_DISMISS)[0]);
Simulate.click(document.getElementsByClassName(Classes.POPOVER_DISMISS)[0]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we must use TestUtils.Simulate on DOM elements outside of enzyme wrappers. this is basically required for Portal-ed components because enzyme + react 15 do not support portals well. enzymejs/enzyme#252

@blueprint-bot
Copy link

fix isotest warnings + enable ResizeHandle

Preview: documentation | table
Coverage: core | datetime

@blueprint-bot
Copy link

react dep first

Preview: documentation | table
Coverage: core | datetime

@blueprint-bot
Copy link

react dep first

Preview: documentation | table
Coverage: core | datetime

@giladgray giladgray merged commit b8d7581 into master May 18, 2017
@giladgray giladgray deleted the gg/test-deprecations branch May 18, 2017 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants