-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* REACT=15 env variable support, test-react15 package for deps * remove isomorphic from main test-commons import because it only supports React 16 * fix message * fix core tests * add circle job `test-15` * remove portal logs * REACT env var in circle * icons isotest * isotests run in 15 or 16, test-commons scripts use require imports * revert isomorphic entry change * fix test imports * react >=15.3.0 peer dependency (for PureComponent) * update docs about react version * Portal docs section about React 15 * rename circle jobs * isReact15 => cannotCreatePortal * revert require() syntax where possible * peer dependency `^15.3.0 || 16` * revert to commonjs syntax with a comment * semantic merge circle config * circle cache * remove console color from enzyme message seems to bork karma-junit-reorter karma-runner/karma-junit-reporter#116
- Loading branch information
Showing
22 changed files
with
242 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright 2018 Palantir Technologies, Inc. All rights reserved. | ||
* | ||
* Licensed under the terms of the LICENSE file distributed with this project. | ||
*/ | ||
|
||
import { ReactWrapper } from "enzyme"; | ||
import { Portal } from "../src"; | ||
|
||
export function findInPortal(overlay: ReactWrapper, selector: string) { | ||
// React 16: createPortal preserves React tree so simple find works. | ||
const element = overlay.find(Portal).find(selector); | ||
if (element.exists()) { | ||
return element; | ||
} | ||
|
||
// React 15: unstable_renderSubtree does not preserve tree so we must create new wrapper. | ||
const portal = overlay.find(Portal).instance(); | ||
const portalChildren = new ReactWrapper(portal.props.children as JSX.Element[]); | ||
if (portalChildren.is(selector)) { | ||
return portalChildren; | ||
} | ||
return portalChildren.find(selector); | ||
} |
Oops, something went wrong.
9a93f09
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.
📦 React 15 support (#2426)
Preview: documentation | landing | table