|
9 | 9 |
|
10 | 10 | 'use strict';
|
11 | 11 |
|
12 |
| -import ReactShallowRenderer from 'react-test-renderer/shallow'; |
13 | 12 | import * as React from 'react';
|
14 | 13 | import * as ReactDOM from 'react-dom';
|
15 | 14 | import * as ReactDOMServer from 'react-dom/server';
|
@@ -383,48 +382,6 @@ describe('ReactTestUtils', () => {
|
383 | 382 | );
|
384 | 383 | });
|
385 | 384 |
|
386 |
| - it('should throw when attempting to use a React element', () => { |
387 |
| - class SomeComponent extends React.Component { |
388 |
| - render() { |
389 |
| - return <div onClick={this.props.handleClick}>hello, world.</div>; |
390 |
| - } |
391 |
| - } |
392 |
| - |
393 |
| - const handler = jest.fn().mockName('spy'); |
394 |
| - const shallowRenderer = ReactShallowRenderer.createRenderer(); |
395 |
| - const result = shallowRenderer.render( |
396 |
| - <SomeComponent handleClick={handler} />, |
397 |
| - ); |
398 |
| - |
399 |
| - expect(() => ReactTestUtils.Simulate.click(result)).toThrowError( |
400 |
| - 'TestUtils.Simulate expected a DOM node as the first argument but received ' + |
401 |
| - 'a React element. Pass the DOM node you wish to simulate the event on instead. ' + |
402 |
| - 'Note that TestUtils.Simulate will not work if you are using shallow rendering.', |
403 |
| - ); |
404 |
| - expect(handler).not.toHaveBeenCalled(); |
405 |
| - }); |
406 |
| - |
407 |
| - it('should throw when attempting to use a component instance', () => { |
408 |
| - class SomeComponent extends React.Component { |
409 |
| - render() { |
410 |
| - return <div onClick={this.props.handleClick}>hello, world.</div>; |
411 |
| - } |
412 |
| - } |
413 |
| - |
414 |
| - const handler = jest.fn().mockName('spy'); |
415 |
| - const container = document.createElement('div'); |
416 |
| - const instance = ReactDOM.render( |
417 |
| - <SomeComponent handleClick={handler} />, |
418 |
| - container, |
419 |
| - ); |
420 |
| - |
421 |
| - expect(() => ReactTestUtils.Simulate.click(instance)).toThrowError( |
422 |
| - 'TestUtils.Simulate expected a DOM node as the first argument but received ' + |
423 |
| - 'a component instance. Pass the DOM node you wish to simulate the event on instead.', |
424 |
| - ); |
425 |
| - expect(handler).not.toHaveBeenCalled(); |
426 |
| - }); |
427 |
| - |
428 | 385 | it('should not warn when used with extra properties', () => {
|
429 | 386 | const CLIENT_X = 100;
|
430 | 387 |
|
|
0 commit comments