Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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: 9 additions & 0 deletions scripts/jest/environment.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
/* eslint-disable */
global.__DEV__ = true;

// For testing DOM Fiber, we synchronously invoke all the scheduling.
global.requestAnimationFrame = function(callback) {
callback();
};

global.requestIdleCallback = function(callback) {
callback({ timeRemaining() { return Infinity; } });
};
4 changes: 4 additions & 0 deletions scripts/jest/test-framework-setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
'use strict';

// We want to globally mock this but jest doesn't let us do that by default
// for a file that already exists. So we have to explicitly mock it.
jest.mock('ReactDOM');

var env = jasmine.getEnv();

var callCount = 0;
Expand Down
17 changes: 17 additions & 0 deletions src/renderers/dom/__mocks__/ReactDOM.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

'use strict';

var ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');

var useFiber = ReactDOMFeatureFlags.useFiber;

module.exports =
useFiber ? require('ReactDOMFiber') : require.requireActual('ReactDOM');
1 change: 1 addition & 0 deletions src/renderers/dom/shared/ReactDOMFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

var ReactDOMFeatureFlags = {
useCreateElement: true,
useFiber: false,
};

module.exports = ReactDOMFeatureFlags;