@samitouri / QOS-React / commits / 9334b771c2

Change test assertion depending on a feature flag (#8306)

Instead of a private API (see https://github.com/facebook/react/pull/8150#discussion_r88280994)

Robin Ricard committed Nov 22, 2016 at 01:17 UTC 9334b771c27eee3dcfb0634599727bfa57b5818e
1 file changed +4 -2
src/isomorphic/classic/element/__tests__/ReactElement-test.js
+4 -2
@@ -14,6 +14,7 @@
14 var React;
15 var ReactDOM;
16 var ReactTestUtils;
17 +var ReactDOMFeatureFlags;
18
19 describe('ReactElement', () => {
20 var ComponentClass;
@@ -30,6 +31,7 @@ describe('ReactElement', () => {
31 React = require('React');
32 ReactDOM = require('ReactDOM');
33 ReactTestUtils = require('ReactTestUtils');
34 + ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
35 // NOTE: We're explicitly not using JSX here. This is intended to test
36 // classic JS without JSX.
37 ComponentClass = React.createClass({
@@ -266,9 +268,9 @@ describe('ReactElement', () => {
268 React.createElement(Wrapper)
269 );
270
269 - if (typeof element._owner.tag === 'number') { // Fiber reconciler
271 + if (ReactDOMFeatureFlags.useFiber) {
272 expect(element._owner.stateNode).toBe(instance);
271 - } else { // Stack reconciler
273 + } else {
274 expect(element._owner.getPublicInstance()).toBe(instance);
275 }
276 });