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
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,19 @@
"@types/chai": "3.4.34",
"@types/classnames": "0.0.31",
"@types/dom4": "1.5.20",
"@types/enzyme": "2.4.36",
"@types/enzyme": "2.8.0",
"@types/mocha": "2.2.32",
"@types/pure-render-decorator": "0.2.27",
"@types/react": "0.14.40",
"@types/react-addons-test-utils": "0.14.15",
"@types/react-dom": "0.14.17",
"@types/react-dom": "15.5.0",
"@types/react-transition-group": "1.1.0",
"@types/tether": "1.1.27",
"autoprefixer": "6.5.2",
"better-handlebars": "github:wmeldon/better-handlebars",
"chai": "3.5.0",
"del": "2.2.2",
"documentalist": "0.0.6",
"enzyme": "2.6.0",
"enzyme": "2.8.2",
"gulp": "3.9.1",
"gulp-concat": "2.6.0",
"gulp-connect": "5.0.0",
Expand Down Expand Up @@ -82,8 +81,8 @@
"postcss-import": "8.2.0",
"postcss-url": "5.1.2",
"react": "15.5.1",
"react-addons-test-utils": "15.5.1",
"react-dom": "15.5.1",
"react-test-renderer": "15.5.4",
"run-sequence": "1.2.2",
"sinon": "1.17.6",
"sorted-object": "2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"devDependencies": {
"bourbon": "4.3.2",
"react": "15.5.1",
"react-addons-test-utils": "15.5.1",
"react-dom": "15.5.1",
"react-test-renderer": "15.5.4",
"react-transition-group": "1.1.3"
},
"repository": {
Expand Down
8 changes: 6 additions & 2 deletions packages/core/src/components/context-menu/contextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ interface IContextMenuState {
onClose?: () => void;
}

const CONSTRAINTS = [ { attachment: "together", pin: true, to: "window" } ];
const TETHER_OPTIONS = {
constraints: [
{ attachment: "together", pin: true, to: "window" },
],
};
const TRANSITION_DURATION = 100;

class ContextMenu extends AbstractComponent<{}, IContextMenuState> {
Expand All @@ -40,7 +44,6 @@ class ContextMenu extends AbstractComponent<{}, IContextMenuState> {
return (
<Popover
backdropProps={{ onContextMenu: this.handleBackdropContextMenu }}
constraints={CONSTRAINTS}
content={content}
enforceFocus={false}
isModal={true}
Expand All @@ -49,6 +52,7 @@ class ContextMenu extends AbstractComponent<{}, IContextMenuState> {
position={Position.RIGHT_TOP}
popoverClassName={Classes.MINIMAL}
useSmartArrowPositioning={false}
tetherOptions={TETHER_OPTIONS}
transitionDuration={TRANSITION_DURATION}
>
<div className={Classes.CONTEXT_MENU_POPOVER_TARGET} style={this.state.offset} />
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/menu/menuTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import { assert } from "chai";
import { mount, shallow, ShallowWrapper } from "enzyme";
import * as React from "react";
import * as TestUtils from "react-addons-test-utils";
import * as ReactDOM from "react-dom";
import * as TestUtils from "react-dom/test-utils";

import { Classes, IMenuItemProps, IMenuProps, Menu, MenuDivider, MenuItem, Popover } from "../../src/index";
import { MenuDividerFactory, MenuFactory, MenuItemFactory } from "../../src/index";
Expand Down
6 changes: 3 additions & 3 deletions packages/core/test/popover/popoverTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { assert } from "chai";
import { mount, ReactWrapper, shallow } from "enzyme";
import * as React from "react";
import * as TestUtils from "react-addons-test-utils";
import { Simulate } from "react-dom/test-utils";

import * as Errors from "../../src/common/errors";
import * as Keys from "../../src/common/keys";
Expand Down Expand Up @@ -319,7 +319,7 @@ describe("<Popover>", () => {
isOpen: true,
onInteraction,
});
TestUtils.Simulate.mouseDown(document.getElementsByClassName("test-hook")[0]);
Simulate.mouseDown(document.getElementsByClassName("test-hook")[0]);
assert.isTrue(onInteraction.calledOnce, "A");
assert.isTrue(onInteraction.calledWith(false), "B");
});
Expand Down Expand Up @@ -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

wrapper.assertIsOpen(false);
});

Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/tabs/tabs2Tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ describe("<Tabs2>", () => {
);

assert.strictEqual(tabs.state("selectedTabId"), "unknown");
assert.isTrue(tabs.find("[aria-selected=true]").isEmpty(), "a tab was selected");
assert.isFalse(tabs.find("[aria-selected=true]").exists(), "a tab was selected");
});

it("invokes onChange() callback but does not change state", () => {
Expand Down Expand Up @@ -291,7 +291,7 @@ describe("<Tabs2>", () => {
});

function findTabById(wrapper: ReactWrapper<ITabs2Props, {}>, id: string) {
return wrapper.find(TAB).filter({ "data-tab-id": id });
return wrapper.find(TAB).filter({ "data-tab-id": id } as React.HTMLAttributes<{}>);
}

function assertIndicatorPosition(wrapper: ReactWrapper<ITabs2Props, ITabs2State>, selectedTabId: string) {
Expand Down
Loading