Skip to content

Instantly share code, notes, and snippets.

@flarnie
Created July 12, 2017 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flarnie/46f744f6981f1f35861ef4cdeba67af1 to your computer and use it in GitHub Desktop.
Save flarnie/46f744f6981f1f35861ef4cdeba67af1 to your computer and use it in GitHub Desktop.
let React = require('react');
var ReactTestUtils = require('react-dom/test-utils');
class TextWithStringRef extends React.Component {
render() {
return (
<span ref="foo">
Hello world!
</span>
);
}
}
describe('when loading two copies of React', () => {
describe('when different React version is used with string ref', () => {
it('has two different copies of React', () => {
jest.resetModules();
let ReactCopy1 = require('react');
expect(ReactCopy1 !== React).toBe(true);
});
it('throws the "Refs must have owner" warning', () => {
jest.resetModules();
let React = require('react');
var testRefsComponent = ReactTestUtils.renderIntoDocument(
<TextWithStringRef />,
);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment