({
enableProfilerTimer = true,
enableProfilerCommitHooks = true,
enableProfilerNestedUpdatePhase = true,
} = {})
| 22 | let waitForThrow; |
| 23 | |
| 24 | function loadModules({ |
| 25 | enableProfilerTimer = true, |
| 26 | enableProfilerCommitHooks = true, |
| 27 | enableProfilerNestedUpdatePhase = true, |
| 28 | } = {}) { |
| 29 | ReactFeatureFlags = require('shared/ReactFeatureFlags'); |
| 30 | |
| 31 | ReactFeatureFlags.enableProfilerTimer = enableProfilerTimer; |
| 32 | ReactFeatureFlags.enableProfilerCommitHooks = enableProfilerCommitHooks; |
| 33 | ReactFeatureFlags.enableProfilerNestedUpdatePhase = |
| 34 | enableProfilerNestedUpdatePhase; |
| 35 | |
| 36 | React = require('react'); |
| 37 | Scheduler = require('scheduler'); |
| 38 | ReactNoop = require('react-noop-renderer'); |
| 39 | const InternalTestUtils = require('internal-test-utils'); |
| 40 | act = InternalTestUtils.act; |
| 41 | assertLog = InternalTestUtils.assertLog; |
| 42 | waitFor = InternalTestUtils.waitFor; |
| 43 | waitForAll = InternalTestUtils.waitForAll; |
| 44 | waitForThrow = InternalTestUtils.waitForThrow; |
| 45 | |
| 46 | AdvanceTime = class extends React.Component { |
| 47 | static defaultProps = { |
| 48 | byAmount: 10, |
| 49 | shouldComponentUpdate: true, |
| 50 | }; |
| 51 | shouldComponentUpdate(nextProps) { |
| 52 | return nextProps.shouldComponentUpdate; |
| 53 | } |
| 54 | render() { |
| 55 | // Simulate time passing when this component is rendered |
| 56 | Scheduler.unstable_advanceTime(this.props.byAmount); |
| 57 | return this.props.children || null; |
| 58 | } |
| 59 | }; |
| 60 | } |
| 61 | |
| 62 | describe(`onRender`, () => { |
| 63 | beforeEach(() => { |
no outgoing calls
no test coverage detected