diff --git a/src/isomorphic/classic/element/ReactElement.js b/src/isomorphic/classic/element/ReactElement.js index f24192b115..49d94b210c 100644 --- a/src/isomorphic/classic/element/ReactElement.js +++ b/src/isomorphic/classic/element/ReactElement.js @@ -17,8 +17,9 @@ var assign = require('Object.assign'); // The Symbol used to tag the ReactElement type. If there is no native Symbol // nor polyfill, then a plain number is used for performance. -var TYPE_SYMBOL = (typeof Symbol === 'function' && Symbol.for && - Symbol.for('react.element')) || 0xeac7; +var TYPE_SYMBOL = + (typeof Symbol === 'function' && Symbol.for && Symbol.for('react.element')) || + 0xeac7; var RESERVED_PROPS = { key: true, diff --git a/src/isomorphic/classic/element/__tests__/ReactElement-test.js b/src/isomorphic/classic/element/__tests__/ReactElement-test.js index 2499eda816..d93aa2eee5 100644 --- a/src/isomorphic/classic/element/__tests__/ReactElement-test.js +++ b/src/isomorphic/classic/element/__tests__/ReactElement-test.js @@ -20,13 +20,15 @@ var ReactTestUtils; describe('ReactElement', function() { var ComponentClass; + var originalSymbol; beforeEach(function() { require('mock-modules').dumpCache(); // Delete the native Symbol if we have one to ensure we test the // unpolyfilled environment. - delete global.Symbol; + originalSymbol = global.Symbol; + global.Symbol = undefined; React = require('React'); ReactDOM = require('ReactDOM'); @@ -38,6 +40,14 @@ describe('ReactElement', function() { }); }); + afterEach(function() { + global.Symbol = originalSymbol; + }); + + it('uses the fallback value when in an environment without Symbol', function() { + expect(
.$$typeof).toBe(0xeac7); + }); + it('returns a complete element according to spec', function() { var element = React.createFactory(ComponentClass)(); expect(element.type).toBe(ComponentClass);