diff --git a/scripts/error-codes/__tests__/dev-expression-with-codes-test.js b/scripts/error-codes/__tests__/dev-expression-with-codes-test.js index fcc1a31513ee2..4a459a550829e 100644 --- a/scripts/error-codes/__tests__/dev-expression-with-codes-test.js +++ b/scripts/error-codes/__tests__/dev-expression-with-codes-test.js @@ -25,7 +25,7 @@ function compare(input, output) { var oldEnv; -describe('dev-expression', function() { +describe('dev-expression', () => { beforeEach(() => { oldEnv = process.env.NODE_ENV; process.env.NODE_ENV = ''; diff --git a/src/addons/__tests__/ReactComponentWithPureRenderMixin-test.js b/src/addons/__tests__/ReactComponentWithPureRenderMixin-test.js index 2c9581994cce4..2f5c7a36c040c 100644 --- a/src/addons/__tests__/ReactComponentWithPureRenderMixin-test.js +++ b/src/addons/__tests__/ReactComponentWithPureRenderMixin-test.js @@ -15,16 +15,16 @@ var React; var ReactComponentWithPureRenderMixin; var ReactTestUtils; -describe('ReactComponentWithPureRenderMixin', function() { +describe('ReactComponentWithPureRenderMixin', () => { - beforeEach(function() { + beforeEach(() => { React = require('React'); ReactComponentWithPureRenderMixin = require('ReactComponentWithPureRenderMixin'); ReactTestUtils = require('ReactTestUtils'); }); - it('provides a default shouldComponentUpdate implementation', function() { + it('provides a default shouldComponentUpdate implementation', () => { var renderCalls = 0; class PlasticWrap extends React.Component { constructor(props, context) { @@ -97,7 +97,7 @@ describe('ReactComponentWithPureRenderMixin', function() { expect(renderCalls).toBe(4); }); - it('does not do a deep comparison', function() { + it('does not do a deep comparison', () => { function getInitialState() { return { foo: [1, 2, 3], diff --git a/src/addons/__tests__/ReactFragment-test.js b/src/addons/__tests__/ReactFragment-test.js index 2ca0302c22332..0f278686a3005 100644 --- a/src/addons/__tests__/ReactFragment-test.js +++ b/src/addons/__tests__/ReactFragment-test.js @@ -15,15 +15,15 @@ var React; var ReactDOM; var ReactFragment; -describe('ReactFragment', function() { +describe('ReactFragment', () => { - beforeEach(function() { + beforeEach(() => { React = require('React'); ReactDOM = require('ReactDOM'); ReactFragment = require('ReactFragment'); }); - it('should throw if a plain object is used as a child', function() { + it('should throw if a plain object is used as a child', () => { var children = { x: , y: , @@ -39,7 +39,7 @@ describe('ReactFragment', function() { ); }); - it('should throw if a plain object even if it is in an owner', function() { + it('should throw if a plain object even if it is in an owner', () => { class Foo extends React.Component { render() { var children = { @@ -59,7 +59,7 @@ describe('ReactFragment', function() { ); }); - it('should throw if a plain object looks like an old element', function() { + it('should throw if a plain object looks like an old element', () => { var oldEl = {_isReactElement: true, type: 'span', props: {}}; var container = document.createElement('div'); expect(() => ReactDOM.render(
{oldEl}
, container)).toThrowError( @@ -70,7 +70,7 @@ describe('ReactFragment', function() { ); }); - it('warns for numeric keys on objects as children', function() { + it('warns for numeric keys on objects as children', () => { spyOn(console, 'error'); ReactFragment.create({1: , 2: }); @@ -81,7 +81,7 @@ describe('ReactFragment', function() { ); }); - it('should warn if passing null to createFragment', function() { + it('should warn if passing null to createFragment', () => { spyOn(console, 'error'); ReactFragment.create(null); expect(console.error.calls.count()).toBe(1); @@ -90,7 +90,7 @@ describe('ReactFragment', function() { ); }); - it('should warn if passing an array to createFragment', function() { + it('should warn if passing an array to createFragment', () => { spyOn(console, 'error'); ReactFragment.create([]); expect(console.error.calls.count()).toBe(1); @@ -99,7 +99,7 @@ describe('ReactFragment', function() { ); }); - it('should warn if passing a ReactElement to createFragment', function() { + it('should warn if passing a ReactElement to createFragment', () => { spyOn(console, 'error'); ReactFragment.create(
); expect(console.error.calls.count()).toBe(1); diff --git a/src/addons/__tests__/renderSubtreeIntoContainer-test.js b/src/addons/__tests__/renderSubtreeIntoContainer-test.js index f0cdd3f9f950d..7e7d12c7a62d0 100644 --- a/src/addons/__tests__/renderSubtreeIntoContainer-test.js +++ b/src/addons/__tests__/renderSubtreeIntoContainer-test.js @@ -16,9 +16,9 @@ var ReactDOM = require('ReactDOM'); var ReactTestUtils = require('ReactTestUtils'); var renderSubtreeIntoContainer = require('renderSubtreeIntoContainer'); -describe('renderSubtreeIntoContainer', function() { +describe('renderSubtreeIntoContainer', () => { - it('should pass context when rendering subtree elsewhere', function() { + it('should pass context when rendering subtree elsewhere', () => { var portal = document.createElement('div'); class Component extends React.Component { @@ -57,7 +57,7 @@ describe('renderSubtreeIntoContainer', function() { expect(portal.firstChild.innerHTML).toBe('bar'); }); - it('should throw if parentComponent is invalid', function() { + it('should throw if parentComponent is invalid', () => { var portal = document.createElement('div'); class Component extends React.Component { @@ -93,7 +93,7 @@ describe('renderSubtreeIntoContainer', function() { } }); - it('should update context if it changes due to setState', function() { + it('should update context if it changes due to setState', () => { var container = document.createElement('div'); document.body.appendChild(container); var portal = document.createElement('div'); @@ -145,7 +145,7 @@ describe('renderSubtreeIntoContainer', function() { expect(portal.firstChild.innerHTML).toBe('changed-changed'); }); - it('should update context if it changes due to re-render', function() { + it('should update context if it changes due to re-render', () => { var container = document.createElement('div'); document.body.appendChild(container); var portal = document.createElement('div'); diff --git a/src/addons/__tests__/update-test.js b/src/addons/__tests__/update-test.js index e2682a70c1527..fe557da38fa40 100644 --- a/src/addons/__tests__/update-test.js +++ b/src/addons/__tests__/update-test.js @@ -13,62 +13,62 @@ var update = require('update'); -describe('update', function() { +describe('update', () => { - describe('$push', function() { - it('pushes', function() { + describe('$push', () => { + it('pushes', () => { expect(update([1], {$push: [7]})).toEqual([1, 7]); }); - it('does not mutate the original object', function() { + it('does not mutate the original object', () => { var obj = [1]; update(obj, {$push: [7]}); expect(obj).toEqual([1]); }); - it('only pushes an array', function() { + it('only pushes an array', () => { expect(update.bind(null, [], {$push: 7})).toThrowError( 'update(): expected spec of $push to be an array; got 7. Did you ' + 'forget to wrap your parameter in an array?' ); }); - it('only pushes unto an array', function() { + it('only pushes unto an array', () => { expect(update.bind(null, 1, {$push: 7})).toThrowError( 'update(): expected target of $push to be an array; got 1.' ); }); }); - describe('$unshift', function() { - it('unshifts', function() { + describe('$unshift', () => { + it('unshifts', () => { expect(update([1], {$unshift: [7]})).toEqual([7, 1]); }); - it('does not mutate the original object', function() { + it('does not mutate the original object', () => { var obj = [1]; update(obj, {$unshift: [7]}); expect(obj).toEqual([1]); }); - it('only unshifts an array', function() { + it('only unshifts an array', () => { expect(update.bind(null, [], {$unshift: 7})).toThrowError( 'update(): expected spec of $unshift to be an array; got 7. Did you ' + 'forget to wrap your parameter in an array?' ); }); - it('only unshifts unto an array', function() { + it('only unshifts unto an array', () => { expect(update.bind(null, 1, {$unshift: 7})).toThrowError( 'update(): expected target of $unshift to be an array; got 1.' ); }); }); - describe('$splice', function() { - it('splices', function() { + describe('$splice', () => { + it('splices', () => { expect(update([1, 4, 3], {$splice: [[1, 1, 2]]})).toEqual([1, 2, 3]); }); - it('does not mutate the original object', function() { + it('does not mutate the original object', () => { var obj = [1, 4, 3]; update(obj, {$splice: [[1, 1, 2]]}); expect(obj).toEqual([1, 4, 3]); }); - it('only splices an array of arrays', function() { + it('only splices an array of arrays', () => { expect(update.bind(null, [], {$splice: 1})).toThrowError( 'update(): expected spec of $splice to be an array of arrays; got 1. ' + 'Did you forget to wrap your parameters in an array?' @@ -78,65 +78,65 @@ describe('update', function() { 'Did you forget to wrap your parameters in an array?' ); }); - it('only splices unto an array', function() { + it('only splices unto an array', () => { expect(update.bind(null, 1, {$splice: 7})).toThrowError( 'Expected $splice target to be an array; got 1' ); }); }); - describe('$merge', function() { - it('merges', function() { + describe('$merge', () => { + it('merges', () => { expect(update({a: 'b'}, {$merge: {c: 'd'}})).toEqual({a: 'b', c: 'd'}); }); - it('does not mutate the original object', function() { + it('does not mutate the original object', () => { var obj = {a: 'b'}; update(obj, {$merge: {c: 'd'}}); expect(obj).toEqual({a: 'b'}); }); - it('only merges with an object', function() { + it('only merges with an object', () => { expect(update.bind(null, {}, {$merge: 7})).toThrowError( 'update(): $merge expects a spec of type \'object\'; got 7' ); }); - it('only merges with an object', function() { + it('only merges with an object', () => { expect(update.bind(null, 7, {$merge: {a: 'b'}})).toThrowError( 'update(): $merge expects a target of type \'object\'; got 7' ); }); }); - describe('$set', function() { - it('sets', function() { + describe('$set', () => { + it('sets', () => { expect(update({a: 'b'}, {$set: {c: 'd'}})).toEqual({c: 'd'}); }); - it('does not mutate the original object', function() { + it('does not mutate the original object', () => { var obj = {a: 'b'}; update(obj, {$set: {c: 'd'}}); expect(obj).toEqual({a: 'b'}); }); }); - describe('$apply', function() { + describe('$apply', () => { var applier = function(node) { return {v: node.v * 2}; }; - it('applies', function() { + it('applies', () => { expect(update({v: 2}, {$apply: applier})).toEqual({v: 4}); }); - it('does not mutate the original object', function() { + it('does not mutate the original object', () => { var obj = {v: 2}; update(obj, {$apply: applier}); expect(obj).toEqual({v: 2}); }); - it('only applies a function', function() { + it('only applies a function', () => { expect(update.bind(null, 2, {$apply: 123})).toThrowError( 'update(): expected spec of $apply to be a function; got 123.' ); }); }); - it('should support deep updates', function() { + it('should support deep updates', () => { expect(update({ a: 'b', c: { @@ -169,7 +169,7 @@ describe('update', function() { }); }); - it('should require a command', function() { + it('should require a command', () => { expect(update.bind(null, {a: 'b'}, {a: 'c'})).toThrowError( 'update(): You provided a key path to update() that did not contain ' + 'one of $push, $unshift, $splice, $set, $merge, $apply. Did you ' + @@ -177,7 +177,7 @@ describe('update', function() { ); }); - it('should perform safe hasOwnProperty check', function() { + it('should perform safe hasOwnProperty check', () => { expect(update({}, {'hasOwnProperty': {$set: 'a'}})).toEqual({ 'hasOwnProperty': 'a', }); diff --git a/src/addons/link/__tests__/LinkedStateMixin-test.js b/src/addons/link/__tests__/LinkedStateMixin-test.js index 01b82351c8cf0..1d6fa18aff85f 100644 --- a/src/addons/link/__tests__/LinkedStateMixin-test.js +++ b/src/addons/link/__tests__/LinkedStateMixin-test.js @@ -12,18 +12,18 @@ 'use strict'; -describe('LinkedStateMixin', function() { +describe('LinkedStateMixin', () => { var LinkedStateMixin; var React; var ReactTestUtils; - beforeEach(function() { + beforeEach(() => { LinkedStateMixin = require('LinkedStateMixin'); React = require('React'); ReactTestUtils = require('ReactTestUtils'); }); - it('should create a ReactLink for state', function() { + it('should create a ReactLink for state', () => { var Component = React.createClass({ mixins: [LinkedStateMixin], diff --git a/src/addons/link/__tests__/ReactLinkPropTypes-test.js b/src/addons/link/__tests__/ReactLinkPropTypes-test.js index 0ca43c4e23980..28fd2d87a1788 100644 --- a/src/addons/link/__tests__/ReactLinkPropTypes-test.js +++ b/src/addons/link/__tests__/ReactLinkPropTypes-test.js @@ -47,8 +47,8 @@ function typeCheckPass(declaration, value) { expect(error).toBe(null); } -describe('ReactLink', function() { - it('should fail if the argument does not implement the Link API', function() { +describe('ReactLink', () => { + it('should fail if the argument does not implement the Link API', () => { typeCheckFail( LinkPropTypes.link(React.PropTypes.any), {}, @@ -75,7 +75,7 @@ describe('ReactLink', function() { ); }); - it('should allow valid links even if no type was specified', function() { + it('should allow valid links even if no type was specified', () => { typeCheckPass( LinkPropTypes.link(), {value: 42, requestChange: emptyFunction} @@ -86,14 +86,14 @@ describe('ReactLink', function() { }); }); - it('should allow no link to be passed at all', function() { + it('should allow no link to be passed at all', () => { typeCheckPass( LinkPropTypes.link(React.PropTypes.string), undefined ); }); - it('should allow valid links with correct value format', function() { + it('should allow valid links with correct value format', () => { typeCheckPass( LinkPropTypes.link(React.PropTypes.any), {value: 42, requestChange: emptyFunction} @@ -108,7 +108,7 @@ describe('ReactLink', function() { ); }); - it('should fail if the link`s value type does not match', function() { + it('should fail if the link`s value type does not match', () => { typeCheckFail( LinkPropTypes.link(React.PropTypes.string), {value: 123, requestChange: emptyFunction}, @@ -117,14 +117,14 @@ describe('ReactLink', function() { ); }); - it('should be implicitly optional and not warn without values', function() { + it('should be implicitly optional and not warn without values', () => { typeCheckPass(LinkPropTypes.link(), null); typeCheckPass(LinkPropTypes.link(), undefined); typeCheckPass(LinkPropTypes.link(React.PropTypes.string), null); typeCheckPass(LinkPropTypes.link(React.PropTypes.string), undefined); }); - it('should warn for missing required values', function() { + it('should warn for missing required values', () => { var specifiedButIsNullMsg = 'The prop `testProp` is marked as required ' + 'in `testComponent`, but its value is `null`.'; typeCheckFail(LinkPropTypes.link().isRequired, null, specifiedButIsNullMsg); @@ -141,7 +141,7 @@ describe('ReactLink', function() { ); }); - it('should be compatible with React.PropTypes.oneOfType', function() { + it('should be compatible with React.PropTypes.oneOfType', () => { typeCheckPass( React.PropTypes.oneOfType([LinkPropTypes.link(React.PropTypes.number)]), {value: 123, requestChange: emptyFunction} diff --git a/src/addons/transitions/__tests__/ReactCSSTransitionGroup-test.js b/src/addons/transitions/__tests__/ReactCSSTransitionGroup-test.js index 72721a4ed104b..492b41e2e79a6 100644 --- a/src/addons/transitions/__tests__/ReactCSSTransitionGroup-test.js +++ b/src/addons/transitions/__tests__/ReactCSSTransitionGroup-test.js @@ -19,10 +19,10 @@ var ReactCSSTransitionGroup; // Most of the real functionality is covered in other unit tests, this just // makes sure we're wired up correctly. -describe('ReactCSSTransitionGroup', function() { +describe('ReactCSSTransitionGroup', () => { var container; - beforeEach(function() { + beforeEach(() => { jest.resetModuleRegistry(); React = require('React'); ReactDOM = require('ReactDOM'); @@ -32,7 +32,7 @@ describe('ReactCSSTransitionGroup', function() { spyOn(console, 'error'); }); - it('should warn if timeouts aren\'t specified', function() { + it('should warn if timeouts aren\'t specified', () => { ReactDOM.render( { ReactDOM.render( { var a = ReactDOM.render( { var a = ReactDOM.render( @@ -129,7 +129,7 @@ describe('ReactCSSTransitionGroup', function() { expect(ReactDOM.findDOMNode(a).childNodes[1].id).toBe('one'); }); - it('should switch transitionLeave from false to true', function() { + it('should switch transitionLeave from false to true', () => { var a = ReactDOM.render( { ReactDOM.render( , container ); }); - it('should work with a null child', function() { + it('should work with a null child', () => { ReactDOM.render( {[null]} @@ -180,7 +180,7 @@ describe('ReactCSSTransitionGroup', function() { ); }); - it('should transition from one to null', function() { + it('should transition from one to null', () => { var a = ReactDOM.render( @@ -200,7 +200,7 @@ describe('ReactCSSTransitionGroup', function() { expect(ReactDOM.findDOMNode(a).childNodes[0].id).toBe('one'); }); - it('should transition from false to one', function() { + it('should transition from false to one', () => { var a = ReactDOM.render( {false} @@ -218,7 +218,7 @@ describe('ReactCSSTransitionGroup', function() { expect(ReactDOM.findDOMNode(a).childNodes[0].id).toBe('one'); }); - it('should use transition-type specific names when they\'re provided', function() { + it('should use transition-type specific names when they\'re provided', () => { var customTransitionNames = { enter: 'custom-entering', leave: 'custom-leaving', @@ -270,7 +270,7 @@ describe('ReactCSSTransitionGroup', function() { expect(CSSCore.hasClass(leavingNode, 'custom-leaving')).toBe(true); }); - it('should clear transition timeouts when unmounted', function() { + it('should clear transition timeouts when unmounted', () => { class Component extends React.Component { render() { return ( @@ -292,7 +292,7 @@ describe('ReactCSSTransitionGroup', function() { jest.runAllTimers(); }); - it('should handle unmounted elements properly', function() { + it('should handle unmounted elements properly', () => { class Child extends React.Component { render() { if (!this.props.show) { diff --git a/src/addons/transitions/__tests__/ReactTransitionChildMapping-test.js b/src/addons/transitions/__tests__/ReactTransitionChildMapping-test.js index 7cc3c63a6f119..621549691ff11 100644 --- a/src/addons/transitions/__tests__/ReactTransitionChildMapping-test.js +++ b/src/addons/transitions/__tests__/ReactTransitionChildMapping-test.js @@ -14,13 +14,13 @@ var React; var ReactTransitionChildMapping; -describe('ReactTransitionChildMapping', function() { - beforeEach(function() { +describe('ReactTransitionChildMapping', () => { + beforeEach(() => { React = require('React'); ReactTransitionChildMapping = require('ReactTransitionChildMapping'); }); - it('should support getChildMapping', function() { + it('should support getChildMapping', () => { var oneone =
; var onetwo =
; var one =
{oneone}{onetwo}
; @@ -34,7 +34,7 @@ describe('ReactTransitionChildMapping', function() { }); }); - it('should support mergeChildMappings for adding keys', function() { + it('should support mergeChildMappings for adding keys', () => { var prev = { one: true, two: true, @@ -51,7 +51,7 @@ describe('ReactTransitionChildMapping', function() { }); }); - it('should support mergeChildMappings for removing keys', function() { + it('should support mergeChildMappings for removing keys', () => { var prev = { one: true, two: true, @@ -68,7 +68,7 @@ describe('ReactTransitionChildMapping', function() { }); }); - it('should support mergeChildMappings for adding and removing', function() { + it('should support mergeChildMappings for adding and removing', () => { var prev = { one: true, two: true, @@ -87,7 +87,7 @@ describe('ReactTransitionChildMapping', function() { }); }); - it('should reconcile overlapping insertions and deletions', function() { + it('should reconcile overlapping insertions and deletions', () => { var prev = { one: true, two: true, @@ -109,7 +109,7 @@ describe('ReactTransitionChildMapping', function() { }); }); - it('should support mergeChildMappings with undefined input', function() { + it('should support mergeChildMappings with undefined input', () => { var prev = { one: true, two: true, diff --git a/src/addons/transitions/__tests__/ReactTransitionGroup-test.js b/src/addons/transitions/__tests__/ReactTransitionGroup-test.js index c19ceeaf9927c..90c0e01900664 100644 --- a/src/addons/transitions/__tests__/ReactTransitionGroup-test.js +++ b/src/addons/transitions/__tests__/ReactTransitionGroup-test.js @@ -17,14 +17,14 @@ var ReactTransitionGroup; // Most of the real functionality is covered in other unit tests, this just // makes sure we're wired up correctly. -describe('ReactTransitionGroup', function() { +describe('ReactTransitionGroup', () => { var container; function normalizeCodeLocInfo(str) { return str.replace(/\(at .+?:\d+\)/g, '(at **)'); } - beforeEach(function() { + beforeEach(() => { React = require('React'); ReactDOM = require('ReactDOM'); ReactTransitionGroup = require('ReactTransitionGroup'); @@ -33,7 +33,7 @@ describe('ReactTransitionGroup', function() { }); - it('should handle willEnter correctly', function() { + it('should handle willEnter correctly', () => { var log = []; class Child extends React.Component { @@ -103,7 +103,7 @@ describe('ReactTransitionGroup', function() { }); }); - it('should handle enter/leave/enter/leave correctly', function() { + it('should handle enter/leave/enter/leave correctly', () => { var log = []; var willEnterCb; @@ -168,7 +168,7 @@ describe('ReactTransitionGroup', function() { ]); }); - it('should handle enter/leave/enter correctly', function() { + it('should handle enter/leave/enter correctly', () => { var log = []; var willEnterCb; @@ -231,7 +231,7 @@ describe('ReactTransitionGroup', function() { ]); }); - it('should handle entering/leaving several elements at once', function() { + it('should handle entering/leaving several elements at once', () => { var log = []; class Child extends React.Component { @@ -296,7 +296,7 @@ describe('ReactTransitionGroup', function() { ]); }); - it('should warn for duplicated keys with component stack info', function() { + it('should warn for duplicated keys with component stack info', () => { spyOn(console, 'error'); class Component extends React.Component { diff --git a/src/isomorphic/children/__tests__/ReactChildren-test.js b/src/isomorphic/children/__tests__/ReactChildren-test.js index 76db6cf31ee94..17dab948599c7 100644 --- a/src/isomorphic/children/__tests__/ReactChildren-test.js +++ b/src/isomorphic/children/__tests__/ReactChildren-test.js @@ -11,18 +11,18 @@ 'use strict'; -describe('ReactChildren', function() { +describe('ReactChildren', () => { var ReactChildren; var React; var ReactFragment; - beforeEach(function() { + beforeEach(() => { ReactChildren = require('ReactChildren'); React = require('React'); ReactFragment = require('ReactFragment'); }); - it('should support identity for simple', function() { + it('should support identity for simple', () => { var callback = jasmine.createSpy().and.callFake(function(kid, index) { return kid; }); @@ -41,7 +41,7 @@ describe('ReactChildren', function() { expect(mappedChildren[0]).toEqual(); }); - it('should treat single arrayless child as being in array', function() { + it('should treat single arrayless child as being in array', () => { var callback = jasmine.createSpy().and.callFake(function(kid, index) { return kid; }); @@ -56,7 +56,7 @@ describe('ReactChildren', function() { expect(mappedChildren[0]).toEqual(); }); - it('should treat single child in array as expected', function() { + it('should treat single child in array as expected', () => { var callback = jasmine.createSpy().and.callFake(function(kid, index) { return kid; }); @@ -72,7 +72,7 @@ describe('ReactChildren', function() { }); - it('should pass key to returned component', function() { + it('should pass key to returned component', () => { var mapFn = function(kid, index) { return
{kid}
; }; @@ -88,7 +88,7 @@ describe('ReactChildren', function() { expect(mappedChildren[0].key).toBe('.$simple'); }); - it('should invoke callback with the right context', function() { + it('should invoke callback with the right context', () => { var lastContext; var callback = function(kid, index) { lastContext = this; @@ -110,7 +110,7 @@ describe('ReactChildren', function() { expect(mappedChildren[0]).toBe(scopeTester); }); - it('should be called for each child', function() { + it('should be called for each child', () => { var zero =
; var one = null; var two =
; @@ -172,7 +172,7 @@ describe('ReactChildren', function() { expect(mappedChildren[3]).toEqual(
); }); - it('should be called for each child in nested structure', function() { + it('should be called for each child in nested structure', () => { var zero =
; var one = null; var two =
; @@ -250,7 +250,7 @@ describe('ReactChildren', function() { expect(mappedChildren[3]).toEqual(
); }); - it('should retain key across two mappings', function() { + it('should retain key across two mappings', () => { var zeroForceKey =
; var oneForceKey =
; @@ -288,7 +288,7 @@ describe('ReactChildren', function() { }); - it('should not throw if key provided is a dupe with array key', function() { + it('should not throw if key provided is a dupe with array key', () => { var zero =
; var one =
; @@ -308,7 +308,7 @@ describe('ReactChildren', function() { }).not.toThrow(); }); - it('should use the same key for a cloned element', function() { + it('should use the same key for a cloned element', () => { var instance = (
@@ -328,7 +328,7 @@ describe('ReactChildren', function() { expect(mapped[0].key).toBe(mappedWithClone[0].key); }); - it('should use the same key for a cloned element with key', function() { + it('should use the same key for a cloned element with key', () => { var instance = (
@@ -348,24 +348,24 @@ describe('ReactChildren', function() { expect(mapped[0].key).toBe(mappedWithClone[0].key); }); - it('should return 0 for null children', function() { + it('should return 0 for null children', () => { var numberOfChildren = ReactChildren.count(null); expect(numberOfChildren).toBe(0); }); - it('should return 0 for undefined children', function() { + it('should return 0 for undefined children', () => { var numberOfChildren = ReactChildren.count(undefined); expect(numberOfChildren).toBe(0); }); - it('should return 1 for single child', function() { + it('should return 1 for single child', () => { var simpleKid = ; var instance =
{simpleKid}
; var numberOfChildren = ReactChildren.count(instance.props.children); expect(numberOfChildren).toBe(1); }); - it('should count the number of children in flat structure', function() { + it('should count the number of children in flat structure', () => { var zero =
; var one = null; var two =
; @@ -385,7 +385,7 @@ describe('ReactChildren', function() { expect(numberOfChildren).toBe(5); }); - it('should count the number of children in nested structure', function() { + it('should count the number of children in nested structure', () => { var zero =
; var one = null; var two =
; @@ -414,7 +414,7 @@ describe('ReactChildren', function() { expect(numberOfChildren).toBe(5); }); - it('should flatten children to an array', function() { + it('should flatten children to an array', () => { expect(ReactChildren.toArray(undefined)).toEqual([]); expect(ReactChildren.toArray(null)).toEqual([]); diff --git a/src/isomorphic/children/__tests__/onlyChild-test.js b/src/isomorphic/children/__tests__/onlyChild-test.js index 1f62f2e2326d2..8de1c9b8073af 100644 --- a/src/isomorphic/children/__tests__/onlyChild-test.js +++ b/src/isomorphic/children/__tests__/onlyChild-test.js @@ -11,14 +11,14 @@ 'use strict'; -describe('onlyChild', function() { +describe('onlyChild', () => { var React; var ReactFragment; var onlyChild; var WrapComponent; - beforeEach(function() { + beforeEach(() => { React = require('React'); ReactFragment = require('ReactFragment'); onlyChild = require('onlyChild'); @@ -33,7 +33,7 @@ describe('onlyChild', function() { }; }); - it('should fail when passed two children', function() { + it('should fail when passed two children', () => { expect(function() { var instance = @@ -44,7 +44,7 @@ describe('onlyChild', function() { }).toThrow(); }); - it('should fail when passed nully values', function() { + it('should fail when passed nully values', () => { expect(function() { var instance = @@ -62,7 +62,7 @@ describe('onlyChild', function() { }).toThrow(); }); - it('should fail when key/value objects', function() { + it('should fail when key/value objects', () => { expect(function() { var instance = @@ -73,7 +73,7 @@ describe('onlyChild', function() { }); - it('should not fail when passed interpolated single child', function() { + it('should not fail when passed interpolated single child', () => { expect(function() { var instance = @@ -84,7 +84,7 @@ describe('onlyChild', function() { }); - it('should return the only child', function() { + it('should return the only child', () => { expect(function() { var instance = diff --git a/src/isomorphic/children/__tests__/sliceChildren-test.js b/src/isomorphic/children/__tests__/sliceChildren-test.js index e6d448162a136..5b41e1f24b682 100644 --- a/src/isomorphic/children/__tests__/sliceChildren-test.js +++ b/src/isomorphic/children/__tests__/sliceChildren-test.js @@ -11,19 +11,19 @@ 'use strict'; -describe('sliceChildren', function() { +describe('sliceChildren', () => { var React; var sliceChildren; - beforeEach(function() { + beforeEach(() => { React = require('React'); sliceChildren = require('sliceChildren'); }); - it('should render the whole set if start zero is supplied', function() { + it('should render the whole set if start zero is supplied', () => { var fullSet = [
,
, @@ -37,7 +37,7 @@ describe('sliceChildren', function() { ]); }); - it('should render the remaining set if no end index is supplied', function() { + it('should render the remaining set if no end index is supplied', () => { var fullSet = [
,
, @@ -50,7 +50,7 @@ describe('sliceChildren', function() { ]); }); - it('should exclude everything at or after the end index', function() { + it('should exclude everything at or after the end index', () => { var fullSet = [
,
, @@ -63,7 +63,7 @@ describe('sliceChildren', function() { ]); }); - it('should allow static children to be sliced', function() { + it('should allow static children to be sliced', () => { var a = ; var b = ; var c = ; @@ -75,7 +75,7 @@ describe('sliceChildren', function() { ]); }); - it('should slice nested children', function() { + it('should slice nested children', () => { var fullSet = [
, [ diff --git a/src/isomorphic/classic/__tests__/ReactContextValidator-test.js b/src/isomorphic/classic/__tests__/ReactContextValidator-test.js index 10b0c22e35d2a..bda23752f7128 100644 --- a/src/isomorphic/classic/__tests__/ReactContextValidator-test.js +++ b/src/isomorphic/classic/__tests__/ReactContextValidator-test.js @@ -23,12 +23,12 @@ var ReactTestUtils; var reactComponentExpect; -describe('ReactContextValidator', function() { +describe('ReactContextValidator', () => { function normalizeCodeLocInfo(str) { return str.replace(/\(at .+?:\d+\)/g, '(at **)'); } - beforeEach(function() { + beforeEach(() => { jest.resetModuleRegistry(); React = require('React'); @@ -40,7 +40,7 @@ describe('ReactContextValidator', function() { // TODO: This behavior creates a runtime dependency on propTypes. We should // ensure that this is not required for ES6 classes with Flow. - it('should filter out context not in contextTypes', function() { + it('should filter out context not in contextTypes', () => { var Component = React.createClass({ contextTypes: { foo: React.PropTypes.string, @@ -73,7 +73,7 @@ describe('ReactContextValidator', function() { reactComponentExpect(instance).expectRenderedChild().scalarContextEqual({foo: 'abc'}); }); - it('should filter context properly in callbacks', function() { + it('should filter context properly in callbacks', () => { var actualComponentWillReceiveProps; var actualShouldComponentUpdate; var actualComponentWillUpdate; @@ -134,7 +134,7 @@ describe('ReactContextValidator', function() { expect(actualComponentDidUpdate).toEqual({foo: 'abc'}); }); - it('should check context types', function() { + it('should check context types', () => { spyOn(console, 'error'); var Component = React.createClass({ @@ -208,7 +208,7 @@ describe('ReactContextValidator', function() { ); }); - it('should check child context types', function() { + it('should check child context types', () => { spyOn(console, 'error'); var Component = React.createClass({ diff --git a/src/isomorphic/classic/class/__tests__/ReactBind-test.js b/src/isomorphic/classic/class/__tests__/ReactBind-test.js index 5d1f4eda94a6b..a5b612eba3a71 100644 --- a/src/isomorphic/classic/class/__tests__/ReactBind-test.js +++ b/src/isomorphic/classic/class/__tests__/ReactBind-test.js @@ -16,9 +16,9 @@ var ReactTestUtils = require('ReactTestUtils'); var reactComponentExpect = require('reactComponentExpect'); // TODO: Test render and all stock methods. -describe('autobinding', function() { +describe('autobinding', () => { - it('Holds reference to instance', function() { + it('Holds reference to instance', () => { var mouseDidEnter = jest.fn(); var mouseDidLeave = jest.fn(); @@ -94,7 +94,7 @@ describe('autobinding', function() { expect(mouseDidLeave.mock.instances[1]).toBe(mountedInstance2); }); - it('works with mixins', function() { + it('works with mixins', () => { var mouseDidClick = jest.fn(); var TestMixin = { @@ -120,7 +120,7 @@ describe('autobinding', function() { expect(mouseDidClick.mock.instances[0]).toBe(mountedInstance1); }); - it('warns if you try to bind to this', function() { + it('warns if you try to bind to this', () => { spyOn(console, 'error'); var TestBindComponent = React.createClass({ @@ -140,7 +140,7 @@ describe('autobinding', function() { ); }); - it('does not warn if you pass an auto-bound method to setState', function() { + it('does not warn if you pass an auto-bound method to setState', () => { spyOn(console, 'error'); var TestBindComponent = React.createClass({ diff --git a/src/isomorphic/classic/class/__tests__/ReactBindOptout-test.js b/src/isomorphic/classic/class/__tests__/ReactBindOptout-test.js index 39ef8f9770540..635b594dee276 100644 --- a/src/isomorphic/classic/class/__tests__/ReactBindOptout-test.js +++ b/src/isomorphic/classic/class/__tests__/ReactBindOptout-test.js @@ -16,9 +16,9 @@ var ReactTestUtils = require('ReactTestUtils'); var reactComponentExpect = require('reactComponentExpect'); // TODO: Test render and all stock methods. -describe('autobind optout', function() { +describe('autobind optout', () => { - it('should work with manual binding', function() { + it('should work with manual binding', () => { var mouseDidEnter = jest.fn(); var mouseDidLeave = jest.fn(); @@ -81,7 +81,7 @@ describe('autobind optout', function() { expect(mouseDidLeave.mock.instances[1]).toBe(mountedInstance2); }); - it('should not hold reference to instance', function() { + it('should not hold reference to instance', () => { var mouseDidClick = function() { void this.state.something; }; @@ -137,7 +137,7 @@ describe('autobind optout', function() { }).toThrow(); }); - it('works with mixins that have not opted out of autobinding', function() { + it('works with mixins that have not opted out of autobinding', () => { var mouseDidClick = jest.fn(); var TestMixin = { @@ -163,7 +163,7 @@ describe('autobind optout', function() { expect(mouseDidClick.mock.instances[0]).toBe(mountedInstance1); }); - it('works with mixins that have opted out of autobinding', function() { + it('works with mixins that have opted out of autobinding', () => { var mouseDidClick = jest.fn(); var TestMixin = { @@ -190,7 +190,7 @@ describe('autobind optout', function() { expect(mouseDidClick.mock.instances[0]).toBe(mountedInstance1); }); - it('does not warn if you try to bind to this', function() { + it('does not warn if you try to bind to this', () => { spyOn(console, 'error'); var TestBindComponent = React.createClass({ @@ -206,7 +206,7 @@ describe('autobind optout', function() { expect(console.error.calls.count()).toBe(0); }); - it('does not warn if you pass an manually bound method to setState', function() { + it('does not warn if you pass an manually bound method to setState', () => { spyOn(console, 'error'); var TestBindComponent = React.createClass({ diff --git a/src/isomorphic/classic/class/__tests__/ReactClass-test.js b/src/isomorphic/classic/class/__tests__/ReactClass-test.js index b55c1079daa9d..e56d3913ba8d3 100644 --- a/src/isomorphic/classic/class/__tests__/ReactClass-test.js +++ b/src/isomorphic/classic/class/__tests__/ReactClass-test.js @@ -15,15 +15,15 @@ var React; var ReactDOM; var ReactTestUtils; -describe('ReactClass-spec', function() { +describe('ReactClass-spec', () => { - beforeEach(function() { + beforeEach(() => { React = require('React'); ReactDOM = require('ReactDOM'); ReactTestUtils = require('ReactTestUtils'); }); - it('should throw when `render` is not specified', function() { + it('should throw when `render` is not specified', () => { expect(function() { React.createClass({}); }).toThrowError( @@ -31,7 +31,7 @@ describe('ReactClass-spec', function() { ); }); - it('should copy `displayName` onto the Constructor', function() { + it('should copy `displayName` onto the Constructor', () => { var TestComponent = React.createClass({ render: function() { return
; @@ -42,7 +42,7 @@ describe('ReactClass-spec', function() { .toBe('TestComponent'); }); - it('should copy prop types onto the Constructor', function() { + it('should copy prop types onto the Constructor', () => { var propValidator = jest.fn(); var TestComponent = React.createClass({ propTypes: { @@ -58,7 +58,7 @@ describe('ReactClass-spec', function() { .toBe(propValidator); }); - it('should warn on invalid prop types', function() { + it('should warn on invalid prop types', () => { spyOn(console, 'error'); React.createClass({ displayName: 'Component', @@ -76,7 +76,7 @@ describe('ReactClass-spec', function() { ); }); - it('should warn on invalid context types', function() { + it('should warn on invalid context types', () => { spyOn(console, 'error'); React.createClass({ displayName: 'Component', @@ -94,7 +94,7 @@ describe('ReactClass-spec', function() { ); }); - it('should throw on invalid child context types', function() { + it('should throw on invalid child context types', () => { spyOn(console, 'error'); React.createClass({ displayName: 'Component', @@ -112,7 +112,7 @@ describe('ReactClass-spec', function() { ); }); - it('should warn when mispelling shouldComponentUpdate', function() { + it('should warn when mispelling shouldComponentUpdate', () => { spyOn(console, 'error'); React.createClass({ @@ -147,7 +147,7 @@ describe('ReactClass-spec', function() { ); }); - it('should warn when mispelling componentWillReceiveProps', function() { + it('should warn when mispelling componentWillReceiveProps', () => { spyOn(console, 'error'); React.createClass({ componentWillRecieveProps: function() { @@ -164,7 +164,7 @@ describe('ReactClass-spec', function() { ); }); - it('should throw if a reserved property is in statics', function() { + it('should throw if a reserved property is in statics', () => { expect(function() { React.createClass({ statics: { @@ -189,7 +189,7 @@ describe('ReactClass-spec', function() { // TODO: Consider actually moving these to statics or drop this unit test. - xit('should warn when using deprecated non-static spec keys', function() { + xit('should warn when using deprecated non-static spec keys', () => { spyOn(console, 'error'); React.createClass({ mixins: [{}], @@ -225,7 +225,7 @@ describe('ReactClass-spec', function() { ); }); - it('should support statics', function() { + it('should support statics', () => { var Component = React.createClass({ statics: { abc: 'def', @@ -255,7 +255,7 @@ describe('ReactClass-spec', function() { expect(Component.pqr()).toBe(Component); }); - it('should work with object getInitialState() return values', function() { + it('should work with object getInitialState() return values', () => { var Component = React.createClass({ getInitialState: function() { return { @@ -271,7 +271,7 @@ describe('ReactClass-spec', function() { expect(instance.state.occupation).toEqual('clown'); }); - it('renders based on context getInitialState', function() { + it('renders based on context getInitialState', () => { var Foo = React.createClass({ contextTypes: { className: React.PropTypes.string, @@ -301,7 +301,7 @@ describe('ReactClass-spec', function() { expect(container.firstChild.className).toBe('foo'); }); - it('should throw with non-object getInitialState() return values', function() { + it('should throw with non-object getInitialState() return values', () => { [['an array'], 'a string', 1234].forEach(function(state) { var Component = React.createClass({ getInitialState: function() { @@ -320,7 +320,7 @@ describe('ReactClass-spec', function() { }); }); - it('should work with a null getInitialState() return value', function() { + it('should work with a null getInitialState() return value', () => { var Component = React.createClass({ getInitialState: function() { return null; @@ -334,7 +334,7 @@ describe('ReactClass-spec', function() { ).not.toThrow(); }); - it('should throw when using legacy factories', function() { + it('should throw when using legacy factories', () => { spyOn(console, 'error'); var Component = React.createClass({ render() { diff --git a/src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js b/src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js index ceedf9c241990..7e80c37f23219 100644 --- a/src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js +++ b/src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js @@ -20,9 +20,9 @@ var TestComponentWithReverseSpec; var mixinPropValidator; var componentPropValidator; -describe('ReactClass-mixin', function() { +describe('ReactClass-mixin', () => { - beforeEach(function() { + beforeEach(() => { React = require('React'); ReactTestUtils = require('ReactTestUtils'); mixinPropValidator = jest.fn(); @@ -106,7 +106,7 @@ describe('ReactClass-mixin', function() { }); }); - it('should support merging propTypes and statics', function() { + it('should support merging propTypes and statics', () => { var listener = jest.fn(); var instance = ; instance = ReactTestUtils.renderIntoDocument(instance); @@ -121,7 +121,7 @@ describe('ReactClass-mixin', function() { expect('staticComponent' in TestComponent).toBe(true); }); - it('should support chaining delegate functions', function() { + it('should support chaining delegate functions', () => { var listener = jest.fn(); var instance = ; instance = ReactTestUtils.renderIntoDocument(instance); @@ -134,7 +134,7 @@ describe('ReactClass-mixin', function() { ]); }); - it('should chain functions regardless of spec property order', function() { + it('should chain functions regardless of spec property order', () => { var listener = jest.fn(); var instance = ; instance = ReactTestUtils.renderIntoDocument(instance); @@ -147,13 +147,13 @@ describe('ReactClass-mixin', function() { ]); }); - it('should validate prop types via mixins', function() { + it('should validate prop types via mixins', () => { expect(TestComponent.propTypes).toBeDefined(); expect(TestComponent.propTypes.value) .toBe(mixinPropValidator); }); - it('should override mixin prop types with class prop types', function() { + it('should override mixin prop types with class prop types', () => { // Sanity check... expect(componentPropValidator).not.toBe(mixinPropValidator); // Actually check... @@ -166,7 +166,7 @@ describe('ReactClass-mixin', function() { }); - it('should support mixins with getInitialState()', function() { + it('should support mixins with getInitialState()', () => { var Mixin = { getInitialState: function() { return {mixin: true}; @@ -187,7 +187,7 @@ describe('ReactClass-mixin', function() { expect(instance.state.mixin).toBe(true); }); - it('should throw with conflicting getInitialState() methods', function() { + it('should throw with conflicting getInitialState() methods', () => { var Mixin = { getInitialState: function() { return {x: true}; @@ -213,7 +213,7 @@ describe('ReactClass-mixin', function() { ); }); - it('should not mutate objects returned by getInitialState()', function() { + it('should not mutate objects returned by getInitialState()', () => { var Mixin = { getInitialState: function() { return Object.freeze({mixin: true}); @@ -233,7 +233,7 @@ describe('ReactClass-mixin', function() { }).not.toThrow(); }); - it('should support statics in mixins', function() { + it('should support statics in mixins', () => { var Mixin = { statics: { foo: 'bar', @@ -258,7 +258,7 @@ describe('ReactClass-mixin', function() { expect(Component.abc).toBe('def'); }); - it("should throw if mixins override each others' statics", function() { + it("should throw if mixins override each others' statics", () => { expect(function() { var Mixin = { statics: { @@ -282,7 +282,7 @@ describe('ReactClass-mixin', function() { ); }); - it('should throw if mixins override functions in statics', function() { + it('should throw if mixins override functions in statics', () => { expect(function() { var Mixin = { statics: { @@ -310,7 +310,7 @@ describe('ReactClass-mixin', function() { ); }); - it('should warn if the mixin is undefined', function() { + it('should warn if the mixin is undefined', () => { spyOn(console, 'error'); React.createClass({ @@ -330,7 +330,7 @@ describe('ReactClass-mixin', function() { ); }); - it('should warn if the mixin is null', function() { + it('should warn if the mixin is null', () => { spyOn(console, 'error'); React.createClass({ @@ -350,7 +350,7 @@ describe('ReactClass-mixin', function() { ); }); - it('should warn if an undefined mixin is included in another mixin', function() { + it('should warn if an undefined mixin is included in another mixin', () => { spyOn(console, 'error'); var mixinA = { @@ -374,7 +374,7 @@ describe('ReactClass-mixin', function() { ); }); - it('should warn if a null mixin is included in another mixin', function() { + it('should warn if a null mixin is included in another mixin', () => { spyOn(console, 'error'); var mixinA = { @@ -398,7 +398,7 @@ describe('ReactClass-mixin', function() { ); }); - it('should throw if the mixin is a React component', function() { + it('should throw if the mixin is a React component', () => { expect(function() { React.createClass({ mixins: [
], @@ -413,7 +413,7 @@ describe('ReactClass-mixin', function() { ); }); - it('should throw if the mixin is a React component class', function() { + it('should throw if the mixin is a React component class', () => { expect(function() { var Component = React.createClass({ render: function() { @@ -434,7 +434,7 @@ describe('ReactClass-mixin', function() { ); }); - it('should have bound the mixin methods to the component', function() { + it('should have bound the mixin methods to the component', () => { var mixin = { mixinFunc: function() { return this; @@ -454,7 +454,7 @@ describe('ReactClass-mixin', function() { instance = ReactTestUtils.renderIntoDocument(instance); }); - it('should include the mixin keys in even if their values are falsy', function() { + it('should include the mixin keys in even if their values are falsy', () => { var mixin = { keyWithNullValue: null, randomCounter: 0, diff --git a/src/isomorphic/classic/element/__tests__/ReactElement-test.js b/src/isomorphic/classic/element/__tests__/ReactElement-test.js index 353989ad6b089..fd500dce87e7c 100644 --- a/src/isomorphic/classic/element/__tests__/ReactElement-test.js +++ b/src/isomorphic/classic/element/__tests__/ReactElement-test.js @@ -15,11 +15,11 @@ var React; var ReactDOM; var ReactTestUtils; -describe('ReactElement', function() { +describe('ReactElement', () => { var ComponentClass; var originalSymbol; - beforeEach(function() { + beforeEach(() => { jest.resetModuleRegistry(); // Delete the native Symbol if we have one to ensure we test the @@ -39,15 +39,15 @@ describe('ReactElement', function() { }); }); - afterEach(function() { + afterEach(() => { global.Symbol = originalSymbol; }); - it('uses the fallback value when in an environment without Symbol', function() { + it('uses the fallback value when in an environment without Symbol', () => { expect(
.$$typeof).toBe(0xeac7); }); - it('returns a complete element according to spec', function() { + it('returns a complete element according to spec', () => { var element = React.createFactory(ComponentClass)(); expect(element.type).toBe(ComponentClass); expect(element.key).toBe(null); @@ -57,7 +57,7 @@ describe('ReactElement', function() { expect(element.props).toEqual({}); }); - it('should warn when `key` is being accessed on createClass element', function() { + it('should warn when `key` is being accessed on createClass element', () => { spyOn(console, 'error'); var container = document.createElement('div'); var Child = React.createClass({ @@ -87,7 +87,7 @@ describe('ReactElement', function() { ); }); - it('should warn when `key` is being accessed on ES class element', function() { + it('should warn when `key` is being accessed on ES class element', () => { spyOn(console, 'error'); var container = document.createElement('div'); class Child extends React.Component { @@ -117,7 +117,7 @@ describe('ReactElement', function() { ); }); - it('should warn when `key` is being accessed on a host element', function() { + it('should warn when `key` is being accessed on a host element', () => { spyOn(console, 'error'); var element =
; expect(console.error.calls.count()).toBe(0); @@ -131,7 +131,7 @@ describe('ReactElement', function() { ); }); - it('should warn when `ref` is being accessed', function() { + it('should warn when `ref` is being accessed', () => { spyOn(console, 'error'); var container = document.createElement('div'); var Child = React.createClass({ @@ -159,7 +159,7 @@ describe('ReactElement', function() { ); }); - it('allows a string to be passed as the type', function() { + it('allows a string to be passed as the type', () => { var element = React.createFactory('div')(); expect(element.type).toBe('div'); expect(element.key).toBe(null); @@ -169,12 +169,12 @@ describe('ReactElement', function() { expect(element.props).toEqual({}); }); - it('returns an immutable element', function() { + it('returns an immutable element', () => { var element = React.createFactory(ComponentClass)(); expect(() => element.type = 'div').toThrow(); }); - it('does not reuse the original config object', function() { + it('does not reuse the original config object', () => { var config = {foo: 1}; var element = React.createFactory(ComponentClass)(config); expect(element.props.foo).toBe(1); @@ -182,13 +182,13 @@ describe('ReactElement', function() { expect(element.props.foo).toBe(1); }); - it('does not fail if config has no prototype', function() { + it('does not fail if config has no prototype', () => { var config = Object.create(null, {foo: {value: 1, enumerable: true}}); var element = React.createFactory(ComponentClass)(config); expect(element.props.foo).toBe(1); }); - it('warns if the config object inherits from any type other than Object', function() { + it('warns if the config object inherits from any type other than Object', () => { spyOn(console, 'error'); React.createElement('div', {foo: 1}); expect(console.error).not.toHaveBeenCalled(); @@ -200,7 +200,7 @@ describe('ReactElement', function() { ); }); - it('extracts key and ref from the config', function() { + it('extracts key and ref from the config', () => { var element = React.createFactory(ComponentClass)({ key: '12', ref: '34', @@ -214,7 +214,7 @@ describe('ReactElement', function() { expect(element.props).toEqual({foo: '56'}); }); - it('extracts null key and ref', function() { + it('extracts null key and ref', () => { var element = React.createFactory(ComponentClass)({ key: null, ref: null, @@ -228,7 +228,7 @@ describe('ReactElement', function() { expect(element.props).toEqual({foo: '12'}); }); - it('ignores undefined key and ref', function() { + it('ignores undefined key and ref', () => { var props = { foo: '56', key: undefined, @@ -243,14 +243,14 @@ describe('ReactElement', function() { expect(element.props).toEqual({foo: '56'}); }); - it('ignores key and ref warning getters', function() { + it('ignores key and ref warning getters', () => { var elementA = React.createElement('div'); var elementB = React.createElement('div', elementA.props); expect(elementB.key).toBe(null); expect(elementB.ref).toBe(null); }); - it('coerces the key to a string', function() { + it('coerces the key to a string', () => { var element = React.createFactory(ComponentClass)({ key: 12, foo: '56', @@ -263,7 +263,7 @@ describe('ReactElement', function() { expect(element.props).toEqual({foo: '56'}); }); - it('preserves the owner on the element', function() { + it('preserves the owner on the element', () => { var Component = React.createFactory(ComponentClass); var element; @@ -281,7 +281,7 @@ describe('ReactElement', function() { expect(element._owner.getPublicInstance()).toBe(instance); }); - it('merges an additional argument onto the children prop', function() { + it('merges an additional argument onto the children prop', () => { spyOn(console, 'error'); var a = 1; var element = React.createFactory(ComponentClass)({ @@ -291,7 +291,7 @@ describe('ReactElement', function() { expect(console.error.calls.count()).toBe(0); }); - it('does not override children if no rest args are provided', function() { + it('does not override children if no rest args are provided', () => { spyOn(console, 'error'); var element = React.createFactory(ComponentClass)({ children: 'text', @@ -300,7 +300,7 @@ describe('ReactElement', function() { expect(console.error.calls.count()).toBe(0); }); - it('overrides children if null is provided as an argument', function() { + it('overrides children if null is provided as an argument', () => { spyOn(console, 'error'); var element = React.createFactory(ComponentClass)({ children: 'text', @@ -309,7 +309,7 @@ describe('ReactElement', function() { expect(console.error.calls.count()).toBe(0); }); - it('merges rest arguments onto the children prop in an array', function() { + it('merges rest arguments onto the children prop in an array', () => { spyOn(console, 'error'); var a = 1; var b = 2; @@ -321,7 +321,7 @@ describe('ReactElement', function() { // NOTE: We're explicitly not using JSX here. This is intended to test // classic JS without JSX. - it('allows static methods to be called using the type property', function() { + it('allows static methods to be called using the type property', () => { spyOn(console, 'error'); var StaticMethodComponentClass = React.createClass({ @@ -345,7 +345,7 @@ describe('ReactElement', function() { // NOTE: We're explicitly not using JSX here. This is intended to test // classic JS without JSX. - it('identifies valid elements', function() { + it('identifies valid elements', () => { var Component = React.createClass({ render: function() { return React.createElement('div'); @@ -369,7 +369,7 @@ describe('ReactElement', function() { expect(React.isValidElement(JSON.parse(jsonElement))).toBe(true); }); - it('allows the use of PropTypes validators in statics', function() { + it('allows the use of PropTypes validators in statics', () => { // TODO: This test was added to cover a special case where we proxied // methods. However, we don't do that any more so this test can probably // be removed. Leaving it in classic as a safety precaution. @@ -386,7 +386,7 @@ describe('ReactElement', function() { // NOTE: We're explicitly not using JSX here. This is intended to test // classic JS without JSX. - it('is indistinguishable from a plain object', function() { + it('is indistinguishable from a plain object', () => { var element = React.createElement('div', {className: 'foo'}); var object = {}; expect(element.constructor).toBe(object.constructor); @@ -394,7 +394,7 @@ describe('ReactElement', function() { // NOTE: We're explicitly not using JSX here. This is intended to test // classic JS without JSX. - it('should use default prop value when removing a prop', function() { + it('should use default prop value when removing a prop', () => { var Component = React.createClass({ getDefaultProps: function() { return {fruit: 'persimmon'}; @@ -417,7 +417,7 @@ describe('ReactElement', function() { // NOTE: We're explicitly not using JSX here. This is intended to test // classic JS without JSX. - it('should normalize props with default values', function() { + it('should normalize props with default values', () => { var Component = React.createClass({ getDefaultProps: function() { return {prop: 'testKey'}; @@ -438,7 +438,7 @@ describe('ReactElement', function() { expect(inst2.props.prop).toBe(null); }); - it('throws when changing a prop (in dev) after element creation', function() { + it('throws when changing a prop (in dev) after element creation', () => { var Outer = React.createClass({ render: function() { var el =
; @@ -455,7 +455,7 @@ describe('ReactElement', function() { expect(ReactDOM.findDOMNode(outer).className).toBe('moo'); }); - it('throws when adding a prop (in dev) after element creation', function() { + it('throws when adding a prop (in dev) after element creation', () => { var container = document.createElement('div'); var Outer = React.createClass({ getDefaultProps: () => ({sound: 'meow'}), @@ -476,7 +476,7 @@ describe('ReactElement', function() { expect(ReactDOM.findDOMNode(outer).className).toBe(''); }); - it('does not warn for NaN props', function() { + it('does not warn for NaN props', () => { spyOn(console, 'error'); var Test = React.createClass({ render: function() { @@ -490,7 +490,7 @@ describe('ReactElement', function() { // NOTE: We're explicitly not using JSX here. This is intended to test // classic JS without JSX. - it('identifies elements, but not JSON, if Symbols are supported', function() { + it('identifies elements, but not JSON, if Symbols are supported', () => { // Rudimentary polyfill // Once all jest engines support Symbols natively we can swap this to test // WITH native Symbols by default. @@ -535,10 +535,10 @@ describe('ReactElement', function() { }); -describe('comparing jsx vs .createFactory() vs .createElement()', function() { +describe('comparing jsx vs .createFactory() vs .createElement()', () => { var Child; - beforeEach(function() { + beforeEach(() => { jest.resetModuleRegistry(); React = require('React'); ReactDOM = require('ReactDOM'); @@ -547,9 +547,9 @@ describe('comparing jsx vs .createFactory() vs .createElement()', function() { }); - describe('when using jsx only', function() { + describe('when using jsx only', () => { var Parent, instance; - beforeEach(function() { + beforeEach(() => { Parent = React.createClass({ render: function() { return ( @@ -562,23 +562,23 @@ describe('comparing jsx vs .createFactory() vs .createElement()', function() { instance = ReactTestUtils.renderIntoDocument(); }); - it('should scry children but cannot', function() { + it('should scry children but cannot', () => { var children = ReactTestUtils.scryRenderedComponentsWithType(instance, Child); expect(children.length).toBe(1); }); - it('does not maintain refs', function() { + it('does not maintain refs', () => { expect(instance.refs.child).not.toBeUndefined(); }); - it('can capture Child instantiation calls', function() { + it('can capture Child instantiation calls', () => { expect(Child.mock.calls[0][0]).toEqual({ foo: 'foo value', children: 'children value' }); }); }); - describe('when using parent that uses .createFactory()', function() { + describe('when using parent that uses .createFactory()', () => { var factory, instance; - beforeEach(function() { + beforeEach(() => { var childFactory = React.createFactory(Child); var Parent = React.createClass({ render: function() { @@ -589,23 +589,23 @@ describe('comparing jsx vs .createFactory() vs .createElement()', function() { instance = ReactTestUtils.renderIntoDocument(factory()); }); - it('can properly scry children', function() { + it('can properly scry children', () => { var children = ReactTestUtils.scryRenderedComponentsWithType(instance, Child); expect(children.length).toBe(1); }); - it('does not maintain refs', function() { + it('does not maintain refs', () => { expect(instance.refs.child).not.toBeUndefined(); }); - it('can capture Child instantiation calls', function() { + it('can capture Child instantiation calls', () => { expect(Child.mock.calls[0][0]).toEqual({ foo: 'foo value', children: 'children value' }); }); }); - describe('when using parent that uses .createElement()', function() { + describe('when using parent that uses .createElement()', () => { var factory, instance; - beforeEach(function() { + beforeEach(() => { var Parent = React.createClass({ render: function() { return React.DOM.div({}, React.createElement(Child, { ref: 'child', foo: 'foo value' }, 'children value')); @@ -615,16 +615,16 @@ describe('comparing jsx vs .createFactory() vs .createElement()', function() { instance = ReactTestUtils.renderIntoDocument(factory()); }); - it('should scry children but cannot', function() { + it('should scry children but cannot', () => { var children = ReactTestUtils.scryRenderedComponentsWithType(instance, Child); expect(children.length).toBe(1); }); - it('does not maintain refs', function() { + it('does not maintain refs', () => { expect(instance.refs.child).not.toBeUndefined(); }); - it('can capture Child instantiation calls', function() { + it('can capture Child instantiation calls', () => { expect(Child.mock.calls[0][0]).toEqual({ foo: 'foo value', children: 'children value' }); }); }); diff --git a/src/isomorphic/classic/element/__tests__/ReactElementClone-test.js b/src/isomorphic/classic/element/__tests__/ReactElementClone-test.js index df62052aeedda..4d98c45f38312 100644 --- a/src/isomorphic/classic/element/__tests__/ReactElementClone-test.js +++ b/src/isomorphic/classic/element/__tests__/ReactElementClone-test.js @@ -15,10 +15,10 @@ var React; var ReactDOM; var ReactTestUtils; -describe('ReactElementClone', function() { +describe('ReactElementClone', () => { var ComponentClass; - beforeEach(function() { + beforeEach(() => { React = require('React'); ReactDOM = require('ReactDOM'); ReactTestUtils = require('ReactTestUtils'); @@ -32,7 +32,7 @@ describe('ReactElementClone', function() { }); }); - it('should clone a DOM component with new props', function() { + it('should clone a DOM component with new props', () => { var Grandparent = React.createClass({ render: function() { return } />; @@ -51,7 +51,7 @@ describe('ReactElementClone', function() { expect(ReactDOM.findDOMNode(component).childNodes[0].className).toBe('xyz'); }); - it('should clone a composite component with new props', function() { + it('should clone a composite component with new props', () => { var Child = React.createClass({ render: function() { return
; @@ -75,7 +75,7 @@ describe('ReactElementClone', function() { expect(ReactDOM.findDOMNode(component).childNodes[0].className).toBe('xyz'); }); - it('should warn if the config object inherits from any type other than Object', function() { + it('should warn if the config object inherits from any type other than Object', () => { spyOn(console, 'error'); React.cloneElement('div', {foo: 1}); expect(console.error).not.toHaveBeenCalled(); @@ -87,12 +87,12 @@ describe('ReactElementClone', function() { ); }); - it('does not fail if config has no prototype', function() { + it('does not fail if config has no prototype', () => { var config = Object.create(null, {foo: {value: 1, enumerable: true}}); React.cloneElement(
, config); }); - it('should keep the original ref if it is not overridden', function() { + it('should keep the original ref if it is not overridden', () => { var Grandparent = React.createClass({ render: function() { return } />; @@ -113,7 +113,7 @@ describe('ReactElementClone', function() { expect(component.refs.yolo.tagName).toBe('DIV'); }); - it('should transfer the key property', function() { + it('should transfer the key property', () => { var Component = React.createClass({ render: function() { return null; @@ -123,7 +123,7 @@ describe('ReactElementClone', function() { expect(clone.key).toBe('xyz'); }); - it('should transfer children', function() { + it('should transfer children', () => { var Component = React.createClass({ render: function() { expect(this.props.children).toBe('xyz'); @@ -136,7 +136,7 @@ describe('ReactElementClone', function() { ); }); - it('should shallow clone children', function() { + it('should shallow clone children', () => { var Component = React.createClass({ render: function() { expect(this.props.children).toBe('xyz'); @@ -149,7 +149,7 @@ describe('ReactElementClone', function() { ); }); - it('should accept children as rest arguments', function() { + it('should accept children as rest arguments', () => { var Component = React.createClass({ render: function() { return null; @@ -169,7 +169,7 @@ describe('ReactElementClone', function() { ]); }); - it('should override children if undefined is provided as an argument', function() { + it('should override children if undefined is provided as an argument', () => { var element = React.createElement(ComponentClass, { children: 'text', }, undefined); @@ -181,7 +181,7 @@ describe('ReactElementClone', function() { expect(element2.props.children).toBe(undefined); }); - it('should support keys and refs', function() { + it('should support keys and refs', () => { var Parent = React.createClass({ render: function() { var clone = @@ -202,7 +202,7 @@ describe('ReactElementClone', function() { expect(component.refs.parent.refs.xyz.tagName).toBe('SPAN'); }); - it('should steal the ref if a new ref is specified', function() { + it('should steal the ref if a new ref is specified', () => { var Parent = React.createClass({ render: function() { var clone = React.cloneElement(this.props.children, {ref: 'xyz'}); @@ -221,7 +221,7 @@ describe('ReactElementClone', function() { expect(component.refs.parent.refs.xyz.tagName).toBe('SPAN'); }); - it('should overwrite props', function() { + it('should overwrite props', () => { var Component = React.createClass({ render: function() { expect(this.props.myprop).toBe('xyz'); @@ -234,7 +234,7 @@ describe('ReactElementClone', function() { ); }); - it('should normalize props with default values', function() { + it('should normalize props with default values', () => { var Component = React.createClass({ getDefaultProps: function() { return {prop: 'testKey'}; @@ -257,7 +257,7 @@ describe('ReactElementClone', function() { expect(cloneInstance4.props.prop).toBe('newTestKey'); }); - it('warns for keys for arrays of elements in rest args', function() { + it('warns for keys for arrays of elements in rest args', () => { spyOn(console, 'error'); React.cloneElement(
, null, [
,
]); @@ -268,7 +268,7 @@ describe('ReactElementClone', function() { ); }); - it('does not warns for arrays of elements with keys', function() { + it('does not warns for arrays of elements with keys', () => { spyOn(console, 'error'); React.cloneElement(
, null, [
,
]); @@ -276,7 +276,7 @@ describe('ReactElementClone', function() { expect(console.error.calls.count()).toBe(0); }); - it('does not warn when the element is directly in rest args', function() { + it('does not warn when the element is directly in rest args', () => { spyOn(console, 'error'); React.cloneElement(
, null,
,
); @@ -284,7 +284,7 @@ describe('ReactElementClone', function() { expect(console.error.calls.count()).toBe(0); }); - it('does not warn when the array contains a non-element', function() { + it('does not warn when the array contains a non-element', () => { spyOn(console, 'error'); React.cloneElement(
, null, [{}, {}]); @@ -292,7 +292,7 @@ describe('ReactElementClone', function() { expect(console.error.calls.count()).toBe(0); }); - it('should check declared prop types after clone', function() { + it('should check declared prop types after clone', () => { spyOn(console, 'error'); var Component = React.createClass({ propTypes: { @@ -327,14 +327,14 @@ describe('ReactElementClone', function() { ); }); - it('should ignore key and ref warning getters', function() { + it('should ignore key and ref warning getters', () => { var elementA = React.createElement('div'); var elementB = React.cloneElement(elementA, elementA.props); expect(elementB.key).toBe(null); expect(elementB.ref).toBe(null); }); - it('should ignore undefined key and ref', function() { + it('should ignore undefined key and ref', () => { var element = React.createFactory(ComponentClass)({ key: '12', ref: '34', @@ -354,7 +354,7 @@ describe('ReactElementClone', function() { expect(clone.props).toEqual({foo: 'ef'}); }); - it('should extract null key and ref', function() { + it('should extract null key and ref', () => { var element = React.createFactory(ComponentClass)({ key: '12', ref: '34', diff --git a/src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js b/src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js index d646e1ae98434..5690e2125b89e 100644 --- a/src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js +++ b/src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js @@ -18,14 +18,14 @@ var React; var ReactDOM; var ReactTestUtils; -describe('ReactElementValidator', function() { +describe('ReactElementValidator', () => { function normalizeCodeLocInfo(str) { return str.replace(/\(at .+?:\d+\)/g, '(at **)'); } var ComponentClass; - beforeEach(function() { + beforeEach(() => { jest.resetModuleRegistry(); React = require('React'); @@ -38,7 +38,7 @@ describe('ReactElementValidator', function() { }); }); - it('warns for keys for arrays of elements in rest args', function() { + it('warns for keys for arrays of elements in rest args', () => { spyOn(console, 'error'); var Component = React.createFactory(ComponentClass); @@ -50,7 +50,7 @@ describe('ReactElementValidator', function() { ); }); - it('warns for keys for arrays of elements with owner info', function() { + it('warns for keys for arrays of elements with owner info', () => { spyOn(console, 'error'); var Component = React.createFactory(ComponentClass); @@ -82,7 +82,7 @@ describe('ReactElementValidator', function() { ); }); - it('warns for keys for arrays with no owner or parent info', function() { + it('warns for keys for arrays with no owner or parent info', () => { spyOn(console, 'error'); var Anonymous = React.createClass({ @@ -106,7 +106,7 @@ describe('ReactElementValidator', function() { ); }); - it('warns for keys for arrays of elements with no owner info', function() { + it('warns for keys for arrays of elements with no owner info', () => { spyOn(console, 'error'); var divs = [ @@ -124,7 +124,7 @@ describe('ReactElementValidator', function() { ); }); - it('warns for keys with component stack info', function() { + it('warns for keys with component stack info', () => { spyOn(console, 'error'); var Component = React.createClass({ @@ -159,7 +159,7 @@ describe('ReactElementValidator', function() { ); }); - it('does not warn for keys when passing children down', function() { + it('does not warn for keys when passing children down', () => { spyOn(console, 'error'); var Wrapper = React.createClass({ @@ -183,7 +183,7 @@ describe('ReactElementValidator', function() { expect(console.error.calls.count()).toBe(0); }); - it('warns for keys for iterables of elements in rest args', function() { + it('warns for keys for iterables of elements in rest args', () => { spyOn(console, 'error'); var Component = React.createFactory(ComponentClass); @@ -207,7 +207,7 @@ describe('ReactElementValidator', function() { ); }); - it('does not warns for arrays of elements with keys', function() { + it('does not warns for arrays of elements with keys', () => { spyOn(console, 'error'); var Component = React.createFactory(ComponentClass); @@ -216,7 +216,7 @@ describe('ReactElementValidator', function() { expect(console.error.calls.count()).toBe(0); }); - it('does not warns for iterable elements with keys', function() { + it('does not warns for iterable elements with keys', () => { spyOn(console, 'error'); var Component = React.createFactory(ComponentClass); @@ -240,7 +240,7 @@ describe('ReactElementValidator', function() { expect(console.error.calls.count()).toBe(0); }); - it('does not warn when the element is directly in rest args', function() { + it('does not warn when the element is directly in rest args', () => { spyOn(console, 'error'); var Component = React.createFactory(ComponentClass); @@ -249,7 +249,7 @@ describe('ReactElementValidator', function() { expect(console.error.calls.count()).toBe(0); }); - it('does not warn when the array contains a non-element', function() { + it('does not warn when the array contains a non-element', () => { spyOn(console, 'error'); var Component = React.createFactory(ComponentClass); @@ -289,7 +289,7 @@ describe('ReactElementValidator', function() { ); }); - it('gives a helpful error when passing null, undefined, boolean, or number', function() { + it('gives a helpful error when passing null, undefined, boolean, or number', () => { spyOn(console, 'error'); React.createElement(undefined); React.createElement(null); @@ -320,7 +320,7 @@ describe('ReactElementValidator', function() { expect(console.error.calls.count()).toBe(4); }); - it('includes the owner name when passing null, undefined, boolean, or number', function() { + it('includes the owner name when passing null, undefined, boolean, or number', () => { spyOn(console, 'error'); var ParentComp = React.createClass({ render: function() { @@ -343,7 +343,7 @@ describe('ReactElementValidator', function() { ); }); - it('should check default prop values', function() { + it('should check default prop values', () => { spyOn(console, 'error'); var Component = React.createClass({ @@ -366,7 +366,7 @@ describe('ReactElementValidator', function() { ); }); - it('should not check the default for explicit null', function() { + it('should not check the default for explicit null', () => { spyOn(console, 'error'); var Component = React.createClass({ @@ -391,7 +391,7 @@ describe('ReactElementValidator', function() { ); }); - it('should check declared prop types', function() { + it('should check declared prop types', () => { spyOn(console, 'error'); var Component = React.createClass({ @@ -433,7 +433,7 @@ describe('ReactElementValidator', function() { expect(console.error.calls.count()).toBe(2); }); - it('should warn if a PropType creator is used as a PropType', function() { + it('should warn if a PropType creator is used as a PropType', () => { spyOn(console, 'error'); var Component = React.createClass({ @@ -459,7 +459,7 @@ describe('ReactElementValidator', function() { ); }); - it('should warn when accessing .type on an element factory', function() { + it('should warn when accessing .type on an element factory', () => { spyOn(console, 'error'); var TestComponent = React.createClass({ render: function() { @@ -478,7 +478,7 @@ describe('ReactElementValidator', function() { expect(console.error.calls.count()).toBe(1); }); - it('does not warn when using DOM node as children', function() { + it('does not warn when using DOM node as children', () => { spyOn(console, 'error'); var DOMContainer = React.createClass({ render: function() { @@ -495,7 +495,7 @@ describe('ReactElementValidator', function() { expect(console.error.calls.count()).toBe(0); }); - it('should not enumerate enumerable numbers (#4776)', function() { + it('should not enumerate enumerable numbers (#4776)', () => { /*eslint-disable no-extend-native */ Number.prototype['@@iterator'] = function() { throw new Error('number iterator called'); @@ -515,7 +515,7 @@ describe('ReactElementValidator', function() { } }); - it('does not blow up with inlined children', function() { + it('does not blow up with inlined children', () => { // We don't suggest this since it silences all sorts of warnings, but we // shouldn't blow up either. @@ -531,7 +531,7 @@ describe('ReactElementValidator', function() { void
{[child]}
; }); - it('does not blow up on key warning with undefined type', function() { + it('does not blow up on key warning with undefined type', () => { spyOn(console, 'error'); var Foo = undefined; void {[
]}; diff --git a/src/isomorphic/classic/types/__tests__/ReactPropTypes-test.js b/src/isomorphic/classic/types/__tests__/ReactPropTypes-test.js index 5b7607c19264c..9f8b991b54ceb 100644 --- a/src/isomorphic/classic/types/__tests__/ReactPropTypes-test.js +++ b/src/isomorphic/classic/types/__tests__/ReactPropTypes-test.js @@ -106,8 +106,8 @@ function expectWarningInDevelopment(declaration, value) { console.error.calls.reset(); } -describe('ReactPropTypes', function() { - beforeEach(function() { +describe('ReactPropTypes', () => { + beforeEach(() => { PropTypes = require('ReactPropTypes'); React = require('React'); ReactFragment = require('ReactFragment'); @@ -115,8 +115,8 @@ describe('ReactPropTypes', function() { ReactPropTypesSecret = require('ReactPropTypesSecret'); }); - describe('Primitive Types', function() { - it('should warn for invalid strings', function() { + describe('Primitive Types', () => { + it('should warn for invalid strings', () => { typeCheckFail( PropTypes.string, [], @@ -149,7 +149,7 @@ describe('ReactPropTypes', function() { ); }); - it('should fail date and regexp correctly', function() { + it('should fail date and regexp correctly', () => { typeCheckFail( PropTypes.string, new Date(), @@ -164,7 +164,7 @@ describe('ReactPropTypes', function() { ); }); - it('should not warn for valid values', function() { + it('should not warn for valid values', () => { typeCheckPass(PropTypes.array, []); typeCheckPass(PropTypes.bool, false); typeCheckPass(PropTypes.func, function() {}); @@ -176,16 +176,16 @@ describe('ReactPropTypes', function() { typeCheckPass(PropTypes.symbol, Symbol()); }); - it('should be implicitly optional and not warn without values', function() { + it('should be implicitly optional and not warn without values', () => { typeCheckPass(PropTypes.string, null); typeCheckPass(PropTypes.string, undefined); }); - it('should warn for missing required values', function() { + it('should warn for missing required values', () => { typeCheckFailRequiredValues(PropTypes.string.isRequired); }); - it('should warn if called manually in development', function() { + it('should warn if called manually in development', () => { spyOn(console, 'error'); expectWarningInDevelopment(PropTypes.array, /please/); expectWarningInDevelopment(PropTypes.array, []); @@ -232,24 +232,24 @@ describe('ReactPropTypes', function() { }); }); - describe('Any type', function() { - it('should should accept any value', function() { + describe('Any type', () => { + it('should should accept any value', () => { typeCheckPass(PropTypes.any, 0); typeCheckPass(PropTypes.any, 'str'); typeCheckPass(PropTypes.any, []); typeCheckPass(PropTypes.any, Symbol()); }); - it('should be implicitly optional and not warn without values', function() { + it('should be implicitly optional and not warn without values', () => { typeCheckPass(PropTypes.any, null); typeCheckPass(PropTypes.any, undefined); }); - it('should warn for missing required values', function() { + it('should warn for missing required values', () => { typeCheckFailRequiredValues(PropTypes.any.isRequired); }); - it('should warn if called manually in development', function() { + it('should warn if called manually in development', () => { spyOn(console, 'error'); expectWarningInDevelopment(PropTypes.any, null); expectWarningInDevelopment(PropTypes.any.isRequired, null); @@ -257,8 +257,8 @@ describe('ReactPropTypes', function() { }); }); - describe('ArrayOf Type', function() { - it('should fail for invalid argument', function() { + describe('ArrayOf Type', () => { + it('should fail for invalid argument', () => { typeCheckFail( PropTypes.arrayOf({ foo: PropTypes.string }), { foo: 'bar' }, @@ -266,14 +266,14 @@ describe('ReactPropTypes', function() { ); }); - it('should support the arrayOf propTypes', function() { + it('should support the arrayOf propTypes', () => { typeCheckPass(PropTypes.arrayOf(PropTypes.number), [1, 2, 3]); typeCheckPass(PropTypes.arrayOf(PropTypes.string), ['a', 'b', 'c']); typeCheckPass(PropTypes.arrayOf(PropTypes.oneOf(['a', 'b'])), ['a', 'b']); typeCheckPass(PropTypes.arrayOf(PropTypes.symbol), [Symbol(), Symbol()]); }); - it('should support arrayOf with complex types', function() { + it('should support arrayOf with complex types', () => { typeCheckPass( PropTypes.arrayOf(PropTypes.shape({a: PropTypes.number.isRequired})), [{a: 1}, {a: 2}] @@ -286,7 +286,7 @@ describe('ReactPropTypes', function() { ); }); - it('should warn with invalid items in the array', function() { + it('should warn with invalid items in the array', () => { typeCheckFail( PropTypes.arrayOf(PropTypes.number), [1, 2, 'b'], @@ -295,7 +295,7 @@ describe('ReactPropTypes', function() { ); }); - it('should warn with invalid complex types', function() { + it('should warn with invalid complex types', () => { function Thing() {} var name = Thing.name || '<>'; @@ -307,7 +307,7 @@ describe('ReactPropTypes', function() { ); }); - it('should warn when passed something other than an array', function() { + it('should warn when passed something other than an array', () => { typeCheckFail( PropTypes.arrayOf(PropTypes.number), {'0': 'maybe-array', length: 1}, @@ -328,22 +328,22 @@ describe('ReactPropTypes', function() { ); }); - it('should not warn when passing an empty array', function() { + it('should not warn when passing an empty array', () => { typeCheckPass(PropTypes.arrayOf(PropTypes.number), []); }); - it('should be implicitly optional and not warn without values', function() { + it('should be implicitly optional and not warn without values', () => { typeCheckPass(PropTypes.arrayOf(PropTypes.number), null); typeCheckPass(PropTypes.arrayOf(PropTypes.number), undefined); }); - it('should warn for missing required values', function() { + it('should warn for missing required values', () => { typeCheckFailRequiredValues( PropTypes.arrayOf(PropTypes.number).isRequired ); }); - it('should warn if called manually in development', function() { + it('should warn if called manually in development', () => { spyOn(console, 'error'); expectWarningInDevelopment( PropTypes.arrayOf({ foo: PropTypes.string }), @@ -362,8 +362,8 @@ describe('ReactPropTypes', function() { }); }); - describe('Component Type', function() { - beforeEach(function() { + describe('Component Type', () => { + beforeEach(() => { Component = class extends React.Component { static propTypes = { label: PropTypes.element.isRequired, @@ -424,16 +424,16 @@ describe('ReactPropTypes', function() { expect(console.error.calls.count()).toBe(1); }); - it('should be implicitly optional and not warn without values', function() { + it('should be implicitly optional and not warn without values', () => { typeCheckPass(PropTypes.element, null); typeCheckPass(PropTypes.element, undefined); }); - it('should warn for missing required values', function() { + it('should warn for missing required values', () => { typeCheckFailRequiredValues(PropTypes.element.isRequired); }); - it('should warn if called manually in development', function() { + it('should warn if called manually in development', () => { spyOn(console, 'error'); expectWarningInDevelopment(PropTypes.element, [
,
]); expectWarningInDevelopment(PropTypes.element,
); @@ -446,8 +446,8 @@ describe('ReactPropTypes', function() { }); - describe('Instance Types', function() { - it('should warn for invalid instances', function() { + describe('Instance Types', () => { + it('should warn for invalid instances', () => { function Person() {} function Cat() {} var personName = Person.name || '<>'; @@ -498,7 +498,7 @@ describe('ReactPropTypes', function() { ); }); - it('should not warn for valid values', function() { + it('should not warn for valid values', () => { function Person() {} function Engineer() {} Engineer.prototype = new Person(); @@ -510,16 +510,16 @@ describe('ReactPropTypes', function() { typeCheckPass(PropTypes.instanceOf(RegExp), /please/); }); - it('should be implicitly optional and not warn without values', function() { + it('should be implicitly optional and not warn without values', () => { typeCheckPass(PropTypes.instanceOf(String), null); typeCheckPass(PropTypes.instanceOf(String), undefined); }); - it('should warn for missing required values', function() { + it('should warn for missing required values', () => { typeCheckFailRequiredValues(PropTypes.instanceOf(String).isRequired); }); - it('should warn if called manually in development', function() { + it('should warn if called manually in development', () => { spyOn(console, 'error'); expectWarningInDevelopment(PropTypes.instanceOf(Date), {}); expectWarningInDevelopment(PropTypes.instanceOf(Date), new Date()); @@ -529,8 +529,8 @@ describe('ReactPropTypes', function() { }); - describe('React Component Types', function() { - beforeEach(function() { + describe('React Component Types', () => { + beforeEach(() => { MyComponent = class extends React.Component { render() { return
; @@ -538,7 +538,7 @@ describe('ReactPropTypes', function() { }; }); - it('should warn for invalid values', function() { + it('should warn for invalid values', () => { var failMessage = 'Invalid prop `testProp` supplied to ' + '`testComponent`, expected a ReactNode.'; typeCheckFail(PropTypes.node, true, failMessage); @@ -547,7 +547,7 @@ describe('ReactPropTypes', function() { typeCheckFail(PropTypes.node, {key:
}, failMessage); }); - it('should not warn for valid values', function() { + it('should not warn for valid values', () => { spyOn(console, 'error'); typeCheckPass(PropTypes.node,
); typeCheckPass(PropTypes.node, false); @@ -580,7 +580,7 @@ describe('ReactPropTypes', function() { expect(console.error.calls.count()).toBe(0); }); - it('should not warn for iterables', function() { + it('should not warn for iterables', () => { var iterable = { '@@iterator': function() { var i = 0; @@ -596,7 +596,7 @@ describe('ReactPropTypes', function() { typeCheckPass(PropTypes.node, iterable); }); - it('should not warn for entry iterables', function() { + it('should not warn for entry iterables', () => { var iterable = { '@@iterator': function() { var i = 0; @@ -613,20 +613,20 @@ describe('ReactPropTypes', function() { typeCheckPass(PropTypes.node, iterable); }); - it('should not warn for null/undefined if not required', function() { + it('should not warn for null/undefined if not required', () => { typeCheckPass(PropTypes.node, null); typeCheckPass(PropTypes.node, undefined); }); - it('should warn for missing required values', function() { + it('should warn for missing required values', () => { typeCheckFailRequiredValues(PropTypes.node.isRequired); }); - it('should accept empty array for required props', function() { + it('should accept empty array for required props', () => { typeCheckPass(PropTypes.node.isRequired, []); }); - it('should warn if called manually in development', function() { + it('should warn if called manually in development', () => { spyOn(console, 'error'); expectWarningInDevelopment(PropTypes.node, 'node'); expectWarningInDevelopment(PropTypes.node, {}); @@ -637,8 +637,8 @@ describe('ReactPropTypes', function() { }); - describe('ObjectOf Type', function() { - it('should fail for invalid argument', function() { + describe('ObjectOf Type', () => { + it('should fail for invalid argument', () => { typeCheckFail( PropTypes.objectOf({ foo: PropTypes.string }), { foo: 'bar' }, @@ -646,7 +646,7 @@ describe('ReactPropTypes', function() { ); }); - it('should support the objectOf propTypes', function() { + it('should support the objectOf propTypes', () => { typeCheckPass(PropTypes.objectOf(PropTypes.number), {a: 1, b: 2, c: 3}); typeCheckPass( PropTypes.objectOf(PropTypes.string), @@ -662,7 +662,7 @@ describe('ReactPropTypes', function() { ); }); - it('should support objectOf with complex types', function() { + it('should support objectOf with complex types', () => { typeCheckPass( PropTypes.objectOf(PropTypes.shape({a: PropTypes.number.isRequired})), {a: {a: 1}, b: {a: 2}} @@ -675,7 +675,7 @@ describe('ReactPropTypes', function() { ); }); - it('should warn with invalid items in the object', function() { + it('should warn with invalid items in the object', () => { typeCheckFail( PropTypes.objectOf(PropTypes.number), {a: 1, b: 2, c: 'b'}, @@ -684,7 +684,7 @@ describe('ReactPropTypes', function() { ); }); - it('should warn with invalid complex types', function() { + it('should warn with invalid complex types', () => { function Thing() {} var name = Thing.name || '<>'; @@ -696,7 +696,7 @@ describe('ReactPropTypes', function() { ); }); - it('should warn when passed something other than an object', function() { + it('should warn when passed something other than an object', () => { typeCheckFail( PropTypes.objectOf(PropTypes.number), [1, 2], @@ -723,22 +723,22 @@ describe('ReactPropTypes', function() { ); }); - it('should not warn when passing an empty object', function() { + it('should not warn when passing an empty object', () => { typeCheckPass(PropTypes.objectOf(PropTypes.number), {}); }); - it('should be implicitly optional and not warn without values', function() { + it('should be implicitly optional and not warn without values', () => { typeCheckPass(PropTypes.objectOf(PropTypes.number), null); typeCheckPass(PropTypes.objectOf(PropTypes.number), undefined); }); - it('should warn for missing required values', function() { + it('should warn for missing required values', () => { typeCheckFailRequiredValues( PropTypes.objectOf(PropTypes.number).isRequired ); }); - it('should warn if called manually in development', function() { + it('should warn if called manually in development', () => { spyOn(console, 'error'); expectWarningInDevelopment( PropTypes.objectOf({ foo: PropTypes.string }), @@ -754,8 +754,8 @@ describe('ReactPropTypes', function() { }); }); - describe('OneOf Types', function() { - it('should warn but not error for invalid argument', function() { + describe('OneOf Types', () => { + it('should warn but not error for invalid argument', () => { spyOn(console, 'error'); PropTypes.oneOf('red', 'blue'); @@ -767,7 +767,7 @@ describe('ReactPropTypes', function() { typeCheckPass(PropTypes.oneOf('red', 'blue'), 'red'); }); - it('should warn for invalid values', function() { + it('should warn for invalid values', () => { typeCheckFail( PropTypes.oneOf(['red', 'blue']), true, @@ -794,22 +794,22 @@ describe('ReactPropTypes', function() { ); }); - it('should not warn for valid values', function() { + it('should not warn for valid values', () => { typeCheckPass(PropTypes.oneOf(['red', 'blue']), 'red'); typeCheckPass(PropTypes.oneOf(['red', 'blue']), 'blue'); typeCheckPass(PropTypes.oneOf(['red', 'blue', NaN]), NaN); }); - it('should be implicitly optional and not warn without values', function() { + it('should be implicitly optional and not warn without values', () => { typeCheckPass(PropTypes.oneOf(['red', 'blue']), null); typeCheckPass(PropTypes.oneOf(['red', 'blue']), undefined); }); - it('should warn for missing required values', function() { + it('should warn for missing required values', () => { typeCheckFailRequiredValues(PropTypes.oneOf(['red', 'blue']).isRequired); }); - it('should warn if called manually in development', function() { + it('should warn if called manually in development', () => { spyOn(console, 'error'); expectWarningInDevelopment(PropTypes.oneOf(['red', 'blue']), true); expectWarningInDevelopment(PropTypes.oneOf(['red', 'blue']), null); @@ -817,8 +817,8 @@ describe('ReactPropTypes', function() { }); }); - describe('Union Types', function() { - it('should warn but not error for invalid argument', function() { + describe('Union Types', () => { + it('should warn but not error for invalid argument', () => { spyOn(console, 'error'); PropTypes.oneOfType(PropTypes.string, PropTypes.number); @@ -830,7 +830,7 @@ describe('ReactPropTypes', function() { typeCheckPass(PropTypes.oneOf(PropTypes.string, PropTypes.number), []); }); - it('should warn if none of the types are valid', function() { + it('should warn if none of the types are valid', () => { typeCheckFail( PropTypes.oneOfType([PropTypes.string, PropTypes.number]), [], @@ -848,7 +848,7 @@ describe('ReactPropTypes', function() { ); }); - it('should not warn if one of the types are valid', function() { + it('should not warn if one of the types are valid', () => { var checker = PropTypes.oneOfType([ PropTypes.string, PropTypes.number, @@ -865,7 +865,7 @@ describe('ReactPropTypes', function() { typeCheckPass(checker, {b: 1}); }); - it('should be implicitly optional and not warn without values', function() { + it('should be implicitly optional and not warn without values', () => { typeCheckPass( PropTypes.oneOfType([PropTypes.string, PropTypes.number]), null ); @@ -874,13 +874,13 @@ describe('ReactPropTypes', function() { ); }); - it('should warn for missing required values', function() { + it('should warn for missing required values', () => { typeCheckFailRequiredValues( PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired ); }); - it('should warn if called manually in development', function() { + it('should warn if called manually in development', () => { spyOn(console, 'error'); expectWarningInDevelopment( PropTypes.oneOfType([PropTypes.string, PropTypes.number]), @@ -898,8 +898,8 @@ describe('ReactPropTypes', function() { }); - describe('Shape Types', function() { - it('should warn for non objects', function() { + describe('Shape Types', () => { + it('should warn for non objects', () => { typeCheckFail( PropTypes.shape({}), 'some string', @@ -914,25 +914,25 @@ describe('ReactPropTypes', function() { ); }); - it('should not warn for empty values', function() { + it('should not warn for empty values', () => { typeCheckPass(PropTypes.shape({}), undefined); typeCheckPass(PropTypes.shape({}), null); typeCheckPass(PropTypes.shape({}), {}); }); - it('should not warn for an empty object', function() { + it('should not warn for an empty object', () => { typeCheckPass(PropTypes.shape({}).isRequired, {}); }); - it('should not warn for non specified types', function() { + it('should not warn for non specified types', () => { typeCheckPass(PropTypes.shape({}), {key: 1}); }); - it('should not warn for valid types', function() { + it('should not warn for valid types', () => { typeCheckPass(PropTypes.shape({key: PropTypes.number}), {key: 1}); }); - it('should warn for required valid types', function() { + it('should warn for required valid types', () => { typeCheckFail( PropTypes.shape({key: PropTypes.number.isRequired}), {}, @@ -941,7 +941,7 @@ describe('ReactPropTypes', function() { ); }); - it('should warn for the first required type', function() { + it('should warn for the first required type', () => { typeCheckFail( PropTypes.shape({ key: PropTypes.number.isRequired, @@ -953,7 +953,7 @@ describe('ReactPropTypes', function() { ); }); - it('should warn for invalid key types', function() { + it('should warn for invalid key types', () => { typeCheckFail(PropTypes.shape({key: PropTypes.number}), {key: 'abc'}, 'Invalid prop `testProp.key` of type `string` supplied to `testComponent`, ' + @@ -961,7 +961,7 @@ describe('ReactPropTypes', function() { ); }); - it('should be implicitly optional and not warn without values', function() { + it('should be implicitly optional and not warn without values', () => { typeCheckPass( PropTypes.shape(PropTypes.shape({key: PropTypes.number})), null ); @@ -970,13 +970,13 @@ describe('ReactPropTypes', function() { ); }); - it('should warn for missing required values', function() { + it('should warn for missing required values', () => { typeCheckFailRequiredValues( PropTypes.shape({key: PropTypes.number}).isRequired ); }); - it('should warn if called manually in development', function() { + it('should warn if called manually in development', () => { spyOn(console, 'error'); expectWarningInDevelopment(PropTypes.shape({}), 'some string'); expectWarningInDevelopment(PropTypes.shape({ foo: PropTypes.number }), { foo: 42 }); @@ -992,8 +992,8 @@ describe('ReactPropTypes', function() { }); }); - describe('Symbol Type', function() { - it('should warn for non-symbol', function() { + describe('Symbol Type', () => { + it('should warn for non-symbol', () => { typeCheckFail( PropTypes.symbol, 'hello', @@ -1016,18 +1016,18 @@ describe('ReactPropTypes', function() { ); }); - it('should not warn for a polyfilled Symbol', function() { + it('should not warn for a polyfilled Symbol', () => { var CoreSymbol = require('core-js/library/es6/symbol'); typeCheckPass(PropTypes.symbol, CoreSymbol('core-js')); }); }); - describe('Custom validator', function() { - beforeEach(function() { + describe('Custom validator', () => { + beforeEach(() => { jest.resetModuleRegistry(); }); - it('should have been called with the right params', function() { + it('should have been called with the right params', () => { var spy = jasmine.createSpy(); Component = class extends React.Component { static propTypes = {num: spy}; @@ -1044,7 +1044,7 @@ describe('ReactPropTypes', function() { expect(spy.calls.argsFor(0)[1]).toBe('num'); }); - it('should have been called even if the prop is not present', function() { + it('should have been called even if the prop is not present', () => { var spy = jasmine.createSpy(); Component = class extends React.Component { static propTypes = {num: spy}; @@ -1061,7 +1061,7 @@ describe('ReactPropTypes', function() { expect(spy.calls.argsFor(0)[1]).toBe('num'); }); - it('should have received the validator\'s return value', function() { + it('should have received the validator\'s return value', () => { spyOn(console, 'error'); var spy = jasmine.createSpy().and.callFake( function(props, propName, componentName) { @@ -1090,7 +1090,7 @@ describe('ReactPropTypes', function() { }); it('should not warn if the validator returned null', - function() { + () => { spyOn(console, 'error'); var spy = jasmine.createSpy().and.callFake( function(props, propName, componentName) { diff --git a/src/isomorphic/modern/class/__tests__/ReactClassEquivalence-test.js b/src/isomorphic/modern/class/__tests__/ReactClassEquivalence-test.js index 79f669adbeb18..b78a2edab1b24 100644 --- a/src/isomorphic/modern/class/__tests__/ReactClassEquivalence-test.js +++ b/src/isomorphic/modern/class/__tests__/ReactClassEquivalence-test.js @@ -14,14 +14,14 @@ var spawnSync = require('child_process').spawnSync; var path = require('path'); -describe('ReactClassEquivalence', function() { - it('tests the same thing for es6 classes and CoffeeScript', function() { +describe('ReactClassEquivalence', () => { + it('tests the same thing for es6 classes and CoffeeScript', () => { var result1 = runJest('ReactCoffeeScriptClass-test.coffee'); var result2 = runJest('ReactES6Class-test.js'); compareResults(result1, result2); }); - it('tests the same thing for es6 classes and TypeScript', function() { + it('tests the same thing for es6 classes and TypeScript', () => { var result1 = runJest('ReactTypeScriptClass-test.ts'); var result2 = runJest('ReactES6Class-test.js'); compareResults(result1, result2); diff --git a/src/isomorphic/modern/class/__tests__/ReactES6Class-test.js b/src/isomorphic/modern/class/__tests__/ReactES6Class-test.js index a477d67b255a5..2ff9091c1a94a 100644 --- a/src/isomorphic/modern/class/__tests__/ReactES6Class-test.js +++ b/src/isomorphic/modern/class/__tests__/ReactES6Class-test.js @@ -14,7 +14,7 @@ var React; var ReactDOM; -describe('ReactES6Class', function() { +describe('ReactES6Class', () => { var container; var freeze = function(expectation) { @@ -25,7 +25,7 @@ describe('ReactES6Class', function() { var attachedListener = null; var renderedName = null; - beforeEach(function() { + beforeEach(() => { React = require('React'); ReactDOM = require('ReactDOM'); container = document.createElement('div'); @@ -51,12 +51,12 @@ describe('ReactES6Class', function() { return instance; } - it('preserves the name of the class for use in error messages', function() { + it('preserves the name of the class for use in error messages', () => { class Foo extends React.Component { } expect(Foo.name).toBe('Foo'); }); - it('throws if no render function is defined', function() { + it('throws if no render function is defined', () => { spyOn(console, 'error'); class Foo extends React.Component { } expect(() => ReactDOM.render(, container)).toThrow(); @@ -68,7 +68,7 @@ describe('ReactES6Class', function() { ); }); - it('renders a simple stateless component with prop', function() { + it('renders a simple stateless component with prop', () => { class Foo extends React.Component { render() { return ; @@ -78,7 +78,7 @@ describe('ReactES6Class', function() { test(, 'DIV', 'bar'); }); - it('renders based on state using initial values in this.props', function() { + it('renders based on state using initial values in this.props', () => { class Foo extends React.Component { constructor(props) { super(props); @@ -91,7 +91,7 @@ describe('ReactES6Class', function() { test(, 'SPAN', 'foo'); }); - it('renders based on state using props in the constructor', function() { + it('renders based on state using props in the constructor', () => { class Foo extends React.Component { constructor(props) { super(props); @@ -112,7 +112,7 @@ describe('ReactES6Class', function() { test(, 'SPAN', 'bar'); }); - it('renders based on context in the constructor', function() { + it('renders based on context in the constructor', () => { class Foo extends React.Component { constructor(props, context) { super(props, context); @@ -143,7 +143,7 @@ describe('ReactES6Class', function() { test(, 'SPAN', 'foo'); }); - it('renders only once when setting state in componentWillMount', function() { + it('renders only once when setting state in componentWillMount', () => { var renderCount = 0; class Foo extends React.Component { constructor(props) { @@ -162,7 +162,7 @@ describe('ReactES6Class', function() { expect(renderCount).toBe(1); }); - it('should throw with non-object in the initial state property', function() { + it('should throw with non-object in the initial state property', () => { [['an array'], 'a string', 1234].forEach(function(state) { class Foo extends React.Component { constructor() { @@ -179,7 +179,7 @@ describe('ReactES6Class', function() { }); }); - it('should render with null in the initial state property', function() { + it('should render with null in the initial state property', () => { class Foo extends React.Component { constructor() { super(); @@ -192,7 +192,7 @@ describe('ReactES6Class', function() { test(, 'SPAN', ''); }); - it('setState through an event handler', function() { + it('setState through an event handler', () => { class Foo extends React.Component { constructor(props) { super(props); @@ -215,7 +215,7 @@ describe('ReactES6Class', function() { expect(renderedName).toBe('bar'); }); - it('should not implicitly bind event handlers', function() { + it('should not implicitly bind event handlers', () => { class Foo extends React.Component { constructor(props) { super(props); @@ -237,7 +237,7 @@ describe('ReactES6Class', function() { expect(attachedListener).toThrow(); }); - it('renders using forceUpdate even when there is no state', function() { + it('renders using forceUpdate even when there is no state', () => { class Foo extends React.Component { constructor(props) { super(props); @@ -261,7 +261,7 @@ describe('ReactES6Class', function() { expect(renderedName).toBe('bar'); }); - it('will call all the normal life cycle methods', function() { + it('will call all the normal life cycle methods', () => { var lifeCycles = []; class Foo extends React.Component { constructor() { @@ -314,7 +314,7 @@ describe('ReactES6Class', function() { ]); }); - it('warns when classic properties are defined on the instance, but does not invoke them.', function() { + it('warns when classic properties are defined on the instance, but does not invoke them.', () => { spyOn(console, 'error'); var getDefaultPropsWasCalled = false; var getInitialStateWasCalled = false; @@ -354,7 +354,7 @@ describe('ReactES6Class', function() { ); }); - it('should warn when misspelling shouldComponentUpdate', function() { + it('should warn when misspelling shouldComponentUpdate', () => { spyOn(console, 'error'); class NamedComponent extends React.Component { @@ -376,7 +376,7 @@ describe('ReactES6Class', function() { ); }); - it('should warn when misspelling componentWillReceiveProps', function() { + it('should warn when misspelling componentWillReceiveProps', () => { spyOn(console, 'error'); class NamedComponent extends React.Component { @@ -397,7 +397,7 @@ describe('ReactES6Class', function() { ); }); - it('should throw AND warn when trying to access classic APIs', function() { + it('should throw AND warn when trying to access classic APIs', () => { spyOn(console, 'error'); var instance = test(, 'DIV', 'foo'); expect(() => instance.replaceState({})).toThrow(); @@ -411,7 +411,7 @@ describe('ReactES6Class', function() { ); }); - it('supports this.context passed via getChildContext', function() { + it('supports this.context passed via getChildContext', () => { class Bar extends React.Component { render() { return
; @@ -430,7 +430,7 @@ describe('ReactES6Class', function() { test(, 'DIV', 'bar-through-context'); }); - it('supports classic refs', function() { + it('supports classic refs', () => { class Foo extends React.Component { render() { return ; @@ -440,7 +440,7 @@ describe('ReactES6Class', function() { expect(instance.refs.inner.getName()).toBe('foo'); }); - it('supports drilling through to the DOM using findDOMNode', function() { + it('supports drilling through to the DOM using findDOMNode', () => { var instance = test(, 'DIV', 'foo'); var node = ReactDOM.findDOMNode(instance); expect(node).toBe(container.firstChild); diff --git a/src/isomorphic/modern/class/__tests__/ReactPureComponent-test.js b/src/isomorphic/modern/class/__tests__/ReactPureComponent-test.js index b340d1afb2831..1235a1ea82ff1 100644 --- a/src/isomorphic/modern/class/__tests__/ReactPureComponent-test.js +++ b/src/isomorphic/modern/class/__tests__/ReactPureComponent-test.js @@ -14,13 +14,13 @@ var React; var ReactDOM; -describe('ReactPureComponent', function() { - beforeEach(function() { +describe('ReactPureComponent', () => { + beforeEach(() => { React = require('React'); ReactDOM = require('ReactDOM'); }); - it('should render', function() { + it('should render', () => { var renders = 0; class Component extends React.PureComponent { constructor() { @@ -63,7 +63,7 @@ describe('ReactPureComponent', function() { expect(renders).toBe(3); }); - it('can override shouldComponentUpdate', function() { + it('can override shouldComponentUpdate', () => { var renders = 0; class Component extends React.PureComponent { render() { @@ -80,7 +80,7 @@ describe('ReactPureComponent', function() { expect(renders).toBe(2); }); - it('extends React.Component', function() { + it('extends React.Component', () => { var renders = 0; class Component extends React.PureComponent { render() { diff --git a/src/isomorphic/modern/element/__tests__/ReactJSXElement-test.js b/src/isomorphic/modern/element/__tests__/ReactJSXElement-test.js index 2e70b0253eccc..1a7be9d7b02ac 100644 --- a/src/isomorphic/modern/element/__tests__/ReactJSXElement-test.js +++ b/src/isomorphic/modern/element/__tests__/ReactJSXElement-test.js @@ -15,10 +15,10 @@ var React; var ReactDOM; var ReactTestUtils; -describe('ReactJSXElement', function() { +describe('ReactJSXElement', () => { var Component; - beforeEach(function() { + beforeEach(() => { jest.resetModuleRegistry(); React = require('React'); @@ -31,7 +31,7 @@ describe('ReactJSXElement', function() { }; }); - it('returns a complete element according to spec', function() { + it('returns a complete element according to spec', () => { var element = ; expect(element.type).toBe(Component); expect(element.key).toBe(null); @@ -41,7 +41,7 @@ describe('ReactJSXElement', function() { expect(element.props).toEqual(expectation); }); - it('allows a lower-case to be passed as the string type', function() { + it('allows a lower-case to be passed as the string type', () => { var element =
; expect(element.type).toBe('div'); expect(element.key).toBe(null); @@ -51,7 +51,7 @@ describe('ReactJSXElement', function() { expect(element.props).toEqual(expectation); }); - it('allows a string to be passed as the type', function() { + it('allows a string to be passed as the type', () => { var TagName = 'div'; var element = ; expect(element.type).toBe('div'); @@ -62,12 +62,12 @@ describe('ReactJSXElement', function() { expect(element.props).toEqual(expectation); }); - it('returns an immutable element', function() { + it('returns an immutable element', () => { var element = ; expect(() => element.type = 'div').toThrow(); }); - it('does not reuse the object that is spread into props', function() { + it('does not reuse the object that is spread into props', () => { var config = {foo: 1}; var element = ; expect(element.props.foo).toBe(1); @@ -75,7 +75,7 @@ describe('ReactJSXElement', function() { expect(element.props.foo).toBe(1); }); - it('extracts key and ref from the rest of the props', function() { + it('extracts key and ref from the rest of the props', () => { var element = ; expect(element.type).toBe(Component); expect(element.key).toBe('12'); @@ -85,7 +85,7 @@ describe('ReactJSXElement', function() { expect(element.props).toEqual(expectation); }); - it('coerces the key to a string', function() { + it('coerces the key to a string', () => { var element = ; expect(element.type).toBe(Component); expect(element.key).toBe('12'); @@ -95,7 +95,7 @@ describe('ReactJSXElement', function() { expect(element.props).toEqual(expectation); }); - it('merges JSX children onto the children prop', function() { + it('merges JSX children onto the children prop', () => { spyOn(console, 'error'); var a = 1; var element = {a}; @@ -103,21 +103,21 @@ describe('ReactJSXElement', function() { expect(console.error.calls.count()).toBe(0); }); - it('does not override children if no JSX children are provided', function() { + it('does not override children if no JSX children are provided', () => { spyOn(console, 'error'); var element = ; expect(element.props.children).toBe('text'); expect(console.error.calls.count()).toBe(0); }); - it('overrides children if null is provided as a JSX child', function() { + it('overrides children if null is provided as a JSX child', () => { spyOn(console, 'error'); var element = {null}; expect(element.props.children).toBe(null); expect(console.error.calls.count()).toBe(0); }); - it('overrides children if undefined is provided as an argument', function() { + it('overrides children if undefined is provided as an argument', () => { var element = {undefined}; expect(element.props.children).toBe(undefined); @@ -129,7 +129,7 @@ describe('ReactJSXElement', function() { expect(element2.props.children).toBe(undefined); }); - it('merges JSX children onto the children prop in an array', function() { + it('merges JSX children onto the children prop in an array', () => { spyOn(console, 'error'); var a = 1; var b = 2; @@ -139,7 +139,7 @@ describe('ReactJSXElement', function() { expect(console.error.calls.count()).toBe(0); }); - it('allows static methods to be called using the type property', function() { + it('allows static methods to be called using the type property', () => { spyOn(console, 'error'); class StaticMethodComponent { @@ -156,7 +156,7 @@ describe('ReactJSXElement', function() { expect(console.error.calls.count()).toBe(0); }); - it('identifies valid elements', function() { + it('identifies valid elements', () => { expect(React.isValidElement(
)).toEqual(true); expect(React.isValidElement()).toEqual(true); @@ -168,13 +168,13 @@ describe('ReactJSXElement', function() { expect(React.isValidElement({ type: 'div', props: {} })).toEqual(false); }); - it('is indistinguishable from a plain object', function() { + it('is indistinguishable from a plain object', () => { var element =
; var object = {}; expect(element.constructor).toBe(object.constructor); }); - it('should use default prop value when removing a prop', function() { + it('should use default prop value when removing a prop', () => { Component.defaultProps = {fruit: 'persimmon'}; var container = document.createElement('div'); @@ -188,7 +188,7 @@ describe('ReactJSXElement', function() { expect(instance.props.fruit).toBe('persimmon'); }); - it('should normalize props with default values', function() { + it('should normalize props with default values', () => { class NormalizingComponent extends React.Component { render() { return {this.props.prop}; diff --git a/src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js b/src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js index 4f5417e08413d..71fbed5bd325b 100644 --- a/src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js +++ b/src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js @@ -17,11 +17,11 @@ var React; var ReactTestUtils; -describe('ReactJSXElementValidator', function() { +describe('ReactJSXElementValidator', () => { var Component; var RequiredPropComponent; - beforeEach(function() { + beforeEach(() => { jest.resetModuleRegistry(); React = require('React'); @@ -42,7 +42,7 @@ describe('ReactJSXElementValidator', function() { RequiredPropComponent.propTypes = {prop: React.PropTypes.string.isRequired}; }); - it('warns for keys for arrays of elements in children position', function() { + it('warns for keys for arrays of elements in children position', () => { spyOn(console, 'error'); void {[, ]}; @@ -53,7 +53,7 @@ describe('ReactJSXElementValidator', function() { ); }); - it('warns for keys for arrays of elements with owner info', function() { + it('warns for keys for arrays of elements with owner info', () => { spyOn(console, 'error'); class InnerComponent extends React.Component { @@ -82,7 +82,7 @@ describe('ReactJSXElementValidator', function() { ); }); - it('warns for keys for iterables of elements in rest args', function() { + it('warns for keys for iterables of elements in rest args', () => { spyOn(console, 'error'); var iterable = { @@ -105,7 +105,7 @@ describe('ReactJSXElementValidator', function() { ); }); - it('does not warns for arrays of elements with keys', function() { + it('does not warns for arrays of elements with keys', () => { spyOn(console, 'error'); void {[, ]}; @@ -113,7 +113,7 @@ describe('ReactJSXElementValidator', function() { expect(console.error.calls.count()).toBe(0); }); - it('does not warns for iterable elements with keys', function() { + it('does not warns for iterable elements with keys', () => { spyOn(console, 'error'); var iterable = { @@ -136,7 +136,7 @@ describe('ReactJSXElementValidator', function() { expect(console.error.calls.count()).toBe(0); }); - it('does not warn for numeric keys in entry iterable as a child', function() { + it('does not warn for numeric keys in entry iterable as a child', () => { spyOn(console, 'error'); var iterable = { @@ -157,7 +157,7 @@ describe('ReactJSXElementValidator', function() { expect(console.error.calls.count()).toBe(0); }); - it('does not warn when the element is directly as children', function() { + it('does not warn when the element is directly as children', () => { spyOn(console, 'error'); void ; @@ -165,7 +165,7 @@ describe('ReactJSXElementValidator', function() { expect(console.error.calls.count()).toBe(0); }); - it('does not warn when the child array contains non-elements', function() { + it('does not warn when the child array contains non-elements', () => { spyOn(console, 'error'); void {[{}, {}]}; @@ -238,7 +238,7 @@ describe('ReactJSXElementValidator', function() { expect(console.error.calls.count()).toBe(4); }); - it('should check default prop values', function() { + it('should check default prop values', () => { spyOn(console, 'error'); RequiredPropComponent.defaultProps = {prop: null}; @@ -255,7 +255,7 @@ describe('ReactJSXElementValidator', function() { ); }); - it('should not check the default for explicit null', function() { + it('should not check the default for explicit null', () => { spyOn(console, 'error'); ReactTestUtils.renderIntoDocument(); @@ -270,7 +270,7 @@ describe('ReactJSXElementValidator', function() { ); }); - it('should check declared prop types', function() { + it('should check declared prop types', () => { spyOn(console, 'error'); ReactTestUtils.renderIntoDocument(); @@ -301,7 +301,7 @@ describe('ReactJSXElementValidator', function() { expect(console.error.calls.count()).toBe(2); }); - it('should warn on invalid prop types', function() { + it('should warn on invalid prop types', () => { // Since there is no prevalidation step for ES6 classes, there is no hook // for us to issue a warning earlier than element creation when the error // actually occurs. Since this step is skipped in production, we should just @@ -323,7 +323,7 @@ describe('ReactJSXElementValidator', function() { ); }); - it('should warn on invalid context types', function() { + it('should warn on invalid context types', () => { spyOn(console, 'error'); class NullContextTypeComponent extends React.Component { render() { @@ -341,7 +341,7 @@ describe('ReactJSXElementValidator', function() { ); }); - it('should warn if getDefaultProps is specificed on the class', function() { + it('should warn if getDefaultProps is specificed on the class', () => { spyOn(console, 'error'); class GetDefaultPropsComponent extends React.Component { render() { diff --git a/src/renderers/art/__tests__/ReactART-test.js b/src/renderers/art/__tests__/ReactART-test.js index 459f808d45f8a..b8cfea1c24b80 100644 --- a/src/renderers/art/__tests__/ReactART-test.js +++ b/src/renderers/art/__tests__/ReactART-test.js @@ -48,9 +48,9 @@ function testDOMNodeStructure(domNode, expectedStructure) { } } -describe('ReactART', function() { +describe('ReactART', () => { - beforeEach(function() { + beforeEach(() => { ARTCurrentMode.setCurrent(ARTSVGMode); Group = ReactART.Group; @@ -96,7 +96,7 @@ describe('ReactART', function() { }; }); - it('should have the correct lifecycle state', function() { + it('should have the correct lifecycle state', () => { var instance = ; instance = ReactTestUtils.renderIntoDocument(instance); var group = instance.refs.group; @@ -104,7 +104,7 @@ describe('ReactART', function() { expect(typeof group.indicate).toBe('function'); }); - it('should render a reasonable SVG structure in SVG mode', function() { + it('should render a reasonable SVG structure in SVG mode', () => { var instance = ; instance = ReactTestUtils.renderIntoDocument(instance); @@ -135,7 +135,7 @@ describe('ReactART', function() { testDOMNodeStructure(realNode, expectedStructure); }); - it('should be able to reorder components', function() { + it('should be able to reorder components', () => { var container = document.createElement('div'); var instance = ReactDOM.render(, container); @@ -179,7 +179,7 @@ describe('ReactART', function() { testDOMNodeStructure(realNode, expectedNewStructure); }); - it('should be able to reorder many components', function() { + it('should be able to reorder many components', () => { var container = document.createElement('div'); class Component extends React.Component { @@ -207,7 +207,7 @@ describe('ReactART', function() { ReactDOM.unmountComponentAtNode(container); }); - it('renders composite with lifecycle inside group', function() { + it('renders composite with lifecycle inside group', () => { var mounted = false; class CustomShape extends React.Component { @@ -230,7 +230,7 @@ describe('ReactART', function() { expect(mounted).toBe(true); }); - it('resolves refs before componentDidMount', function() { + it('resolves refs before componentDidMount', () => { class CustomShape extends React.Component { render() { return ; @@ -259,7 +259,7 @@ describe('ReactART', function() { expect(ref.constructor).toBe(CustomShape); }); - it('resolves refs before componentDidUpdate', function() { + it('resolves refs before componentDidUpdate', () => { class CustomShape extends React.Component { render() { return ; diff --git a/src/renderers/dom/__tests__/ReactDOMProduction-test.js b/src/renderers/dom/__tests__/ReactDOMProduction-test.js index 5b1d4ebf94835..c25d5e7595dc1 100644 --- a/src/renderers/dom/__tests__/ReactDOMProduction-test.js +++ b/src/renderers/dom/__tests__/ReactDOMProduction-test.js @@ -10,13 +10,13 @@ */ 'use strict'; -describe('ReactDOMProduction', function() { +describe('ReactDOMProduction', () => { var oldProcess; var React; var ReactDOM; - beforeEach(function() { + beforeEach(() => { __DEV__ = false; oldProcess = process; global.process = {env: {NODE_ENV: 'production'}}; @@ -26,12 +26,12 @@ describe('ReactDOMProduction', function() { ReactDOM = require('ReactDOM'); }); - afterEach(function() { + afterEach(() => { __DEV__ = true; global.process = oldProcess; }); - it('should use prod fbjs', function() { + it('should use prod fbjs', () => { var warning = require('warning'); spyOn(console, 'error'); @@ -39,7 +39,7 @@ describe('ReactDOMProduction', function() { expect(console.error.calls.count()).toBe(0); }); - it('should use prod React', function() { + it('should use prod React', () => { spyOn(console, 'error'); // no key warning @@ -48,7 +48,7 @@ describe('ReactDOMProduction', function() { expect(console.error.calls.count()).toBe(0); }); - it('should handle a simple flow', function() { + it('should handle a simple flow', () => { class Component extends React.Component { render() { return {this.props.children}; @@ -86,7 +86,7 @@ describe('ReactDOMProduction', function() { expect(container.childNodes.length).toBe(0); }); - it('should call lifecycle methods', function() { + it('should call lifecycle methods', () => { var log = []; class Component extends React.Component { state = {y: 1}; @@ -174,7 +174,7 @@ describe('ReactDOMProduction', function() { ]); }); - it('should throw with an error code in production', function() { + it('should throw with an error code in production', () => { expect(function() { class Component extends React.Component { render() { diff --git a/src/renderers/dom/client/__tests__/ReactBrowserEventEmitter-test.js b/src/renderers/dom/client/__tests__/ReactBrowserEventEmitter-test.js index 920dc48056fd5..d76d4868a32d8 100644 --- a/src/renderers/dom/client/__tests__/ReactBrowserEventEmitter-test.js +++ b/src/renderers/dom/client/__tests__/ReactBrowserEventEmitter-test.js @@ -55,8 +55,8 @@ function getInternal(node) { } -describe('ReactBrowserEventEmitter', function() { - beforeEach(function() { +describe('ReactBrowserEventEmitter', () => { + beforeEach(() => { jest.resetModuleRegistry(); LISTENER.mockClear(); EventListener = require('EventListener'); @@ -83,26 +83,26 @@ describe('ReactBrowserEventEmitter', function() { }); }); - it('should store a listener correctly', function() { + it('should store a listener correctly', () => { registerSimpleTestHandler(); var listener = EventPluginHub.getListener(getInternal(CHILD), ON_CLICK_KEY); expect(listener).toBe(LISTENER); }); - it('should retrieve a listener correctly', function() { + it('should retrieve a listener correctly', () => { registerSimpleTestHandler(); var listener = EventPluginHub.getListener(getInternal(CHILD), ON_CLICK_KEY); expect(listener).toEqual(LISTENER); }); - it('should clear all handlers when asked to', function() { + it('should clear all handlers when asked to', () => { registerSimpleTestHandler(); EventPluginHub.deleteAllListeners(getInternal(CHILD)); var listener = EventPluginHub.getListener(getInternal(CHILD), ON_CLICK_KEY); expect(listener).toBe(undefined); }); - it('should invoke a simple handler registered on a node', function() { + it('should invoke a simple handler registered on a node', () => { registerSimpleTestHandler(); ReactTestUtils.Simulate.click(CHILD); expect(LISTENER.mock.calls.length).toBe(1); @@ -110,7 +110,7 @@ describe('ReactBrowserEventEmitter', function() { it( 'should not invoke handlers if ReactBrowserEventEmitter is disabled', - function() { + () => { registerSimpleTestHandler(); ReactBrowserEventEmitter.setEnabled(false); ReactTestUtils.SimulateNative.click(CHILD); @@ -121,7 +121,7 @@ describe('ReactBrowserEventEmitter', function() { } ); - it('should bubble simply', function() { + it('should bubble simply', () => { EventPluginHub.putListener( getInternal(CHILD), ON_CLICK_KEY, @@ -144,7 +144,7 @@ describe('ReactBrowserEventEmitter', function() { expect(idCallOrder[2]).toBe(getInternal(GRANDPARENT)); }); - it('should continue bubbling if an error is thrown', function() { + it('should continue bubbling if an error is thrown', () => { EventPluginHub.putListener( getInternal(CHILD), ON_CLICK_KEY, @@ -172,7 +172,7 @@ describe('ReactBrowserEventEmitter', function() { expect(idCallOrder[2]).toBe(getInternal(GRANDPARENT)); }); - it('should set currentTarget', function() { + it('should set currentTarget', () => { EventPluginHub.putListener( getInternal(CHILD), ON_CLICK_KEY, @@ -204,7 +204,7 @@ describe('ReactBrowserEventEmitter', function() { expect(idCallOrder[2]).toBe(getInternal(GRANDPARENT)); }); - it('should support stopPropagation()', function() { + it('should support stopPropagation()', () => { EventPluginHub.putListener( getInternal(CHILD), ON_CLICK_KEY, @@ -226,7 +226,7 @@ describe('ReactBrowserEventEmitter', function() { expect(idCallOrder[1]).toBe(getInternal(PARENT)); }); - it('should stop after first dispatch if stopPropagation', function() { + it('should stop after first dispatch if stopPropagation', () => { EventPluginHub.putListener( getInternal(CHILD), ON_CLICK_KEY, @@ -247,7 +247,7 @@ describe('ReactBrowserEventEmitter', function() { expect(idCallOrder[0]).toBe(getInternal(CHILD)); }); - it('should not stopPropagation if false is returned', function() { + it('should not stopPropagation if false is returned', () => { EventPluginHub.putListener( getInternal(CHILD), ON_CLICK_KEY, @@ -281,7 +281,7 @@ describe('ReactBrowserEventEmitter', function() { * these new listeners. */ - it('should invoke handlers that were removed while bubbling', function() { + it('should invoke handlers that were removed while bubbling', () => { var handleParentClick = jest.fn(); var handleChildClick = function(event) { EventPluginHub.deleteAllListeners(getInternal(PARENT)); @@ -300,7 +300,7 @@ describe('ReactBrowserEventEmitter', function() { expect(handleParentClick.mock.calls.length).toBe(1); }); - it('should not invoke newly inserted handlers while bubbling', function() { + it('should not invoke newly inserted handlers while bubbling', () => { var handleParentClick = jest.fn(); var handleChildClick = function(event) { EventPluginHub.putListener( @@ -318,7 +318,7 @@ describe('ReactBrowserEventEmitter', function() { expect(handleParentClick.mock.calls.length).toBe(0); }); - it('should have mouse enter simulated by test utils', function() { + it('should have mouse enter simulated by test utils', () => { EventPluginHub.putListener( getInternal(CHILD), ON_MOUSE_ENTER_KEY, @@ -329,7 +329,7 @@ describe('ReactBrowserEventEmitter', function() { expect(idCallOrder[0]).toBe(getInternal(CHILD)); }); - it('should infer onTouchTap from a touchStart/End', function() { + it('should infer onTouchTap from a touchStart/End', () => { EventPluginHub.putListener( getInternal(CHILD), ON_TOUCH_TAP_KEY, @@ -347,7 +347,7 @@ describe('ReactBrowserEventEmitter', function() { expect(idCallOrder[0]).toBe(getInternal(CHILD)); }); - it('should infer onTouchTap from when dragging below threshold', function() { + it('should infer onTouchTap from when dragging below threshold', () => { EventPluginHub.putListener( getInternal(CHILD), ON_TOUCH_TAP_KEY, @@ -365,7 +365,7 @@ describe('ReactBrowserEventEmitter', function() { expect(idCallOrder[0]).toBe(getInternal(CHILD)); }); - it('should not onTouchTap from when dragging beyond threshold', function() { + it('should not onTouchTap from when dragging beyond threshold', () => { EventPluginHub.putListener( getInternal(CHILD), ON_TOUCH_TAP_KEY, @@ -382,14 +382,14 @@ describe('ReactBrowserEventEmitter', function() { expect(idCallOrder.length).toBe(0); }); - it('should listen to events only once', function() { + it('should listen to events only once', () => { spyOn(EventListener, 'listen'); ReactBrowserEventEmitter.listenTo(ON_CLICK_KEY, document); ReactBrowserEventEmitter.listenTo(ON_CLICK_KEY, document); expect(EventListener.listen.calls.count()).toBe(1); }); - it('should work with event plugins without dependencies', function() { + it('should work with event plugins without dependencies', () => { spyOn(EventListener, 'listen'); ReactBrowserEventEmitter.listenTo(ON_CLICK_KEY, document); @@ -397,7 +397,7 @@ describe('ReactBrowserEventEmitter', function() { expect(EventListener.listen.calls.argsFor(0)[1]).toBe('click'); }); - it('should work with event plugins with dependencies', function() { + it('should work with event plugins with dependencies', () => { spyOn(EventListener, 'listen'); spyOn(EventListener, 'capture'); @@ -422,7 +422,7 @@ describe('ReactBrowserEventEmitter', function() { } }); - it('should bubble onTouchTap', function() { + it('should bubble onTouchTap', () => { EventPluginHub.putListener( getInternal(CHILD), ON_TOUCH_TAP_KEY, @@ -452,7 +452,7 @@ describe('ReactBrowserEventEmitter', function() { expect(idCallOrder[2]).toBe(getInternal(GRANDPARENT)); }); - it('should not crash ensureScrollValueMonitoring when createEvent returns null', function() { + it('should not crash ensureScrollValueMonitoring when createEvent returns null', () => { var originalCreateEvent = document.createEvent; document.createEvent = function() { return null; diff --git a/src/renderers/dom/client/__tests__/ReactDOM-test.js b/src/renderers/dom/client/__tests__/ReactDOM-test.js index 86d85f8dbe043..76bc51e85ebd8 100644 --- a/src/renderers/dom/client/__tests__/ReactDOM-test.js +++ b/src/renderers/dom/client/__tests__/ReactDOM-test.js @@ -16,7 +16,7 @@ var ReactDOM = require('ReactDOM'); var ReactTestUtils = require('ReactTestUtils'); var div = React.createFactory('div'); -describe('ReactDOM', function() { +describe('ReactDOM', () => { // TODO: uncomment this test once we can run in phantom, which // supports real submit events. /* @@ -46,13 +46,13 @@ describe('ReactDOM', function() { }); */ - it('allows a DOM element to be used with a string', function() { + it('allows a DOM element to be used with a string', () => { var element = React.createElement('div', {className: 'foo'}); var instance = ReactTestUtils.renderIntoDocument(element); expect(ReactDOM.findDOMNode(instance).tagName).toBe('DIV'); }); - it('should allow children to be passed as an argument', function() { + it('should allow children to be passed as an argument', () => { var argDiv = ReactTestUtils.renderIntoDocument( div(null, 'child') ); @@ -60,7 +60,7 @@ describe('ReactDOM', function() { expect(argNode.innerHTML).toBe('child'); }); - it('should overwrite props.children with children argument', function() { + it('should overwrite props.children with children argument', () => { var conflictDiv = ReactTestUtils.renderIntoDocument( div({children: 'fakechild'}, 'child') ); @@ -72,7 +72,7 @@ describe('ReactDOM', function() { * We need to make sure that updates occur to the actual node that's in the * DOM, instead of a stale cache. */ - it('should purge the DOM cache when removing nodes', function() { + it('should purge the DOM cache when removing nodes', () => { var myDiv = ReactTestUtils.renderIntoDocument(
, @@ -111,14 +111,14 @@ describe('ReactDOM', function() { expect(dog.className).toBe('bigdog'); }); - it('allow React.DOM factories to be called without warnings', function() { + it('allow React.DOM factories to be called without warnings', () => { spyOn(console, 'error'); var element = React.DOM.div(); expect(element.type).toBe('div'); expect(console.error.calls.count()).toBe(0); }); - it('throws in render() if the mount callback is not a function', function() { + it('throws in render() if the mount callback is not a function', () => { function Foo() { this.a = 1; this.b = 2; @@ -147,7 +147,7 @@ describe('ReactDOM', function() { ); }); - it('throws in render() if the update callback is not a function', function() { + it('throws in render() if the update callback is not a function', () => { function Foo() { this.a = 1; this.b = 2; diff --git a/src/renderers/dom/client/__tests__/ReactDOMComponentTree-test.js b/src/renderers/dom/client/__tests__/ReactDOMComponentTree-test.js index 77d822c795a4d..71733578e0934 100644 --- a/src/renderers/dom/client/__tests__/ReactDOMComponentTree-test.js +++ b/src/renderers/dom/client/__tests__/ReactDOMComponentTree-test.js @@ -11,7 +11,7 @@ 'use strict'; -describe('ReactDOMComponentTree', function() { +describe('ReactDOMComponentTree', () => { var React; var ReactDOM; var ReactDOMComponentTree; @@ -24,14 +24,14 @@ describe('ReactDOMComponentTree', function() { return ReactDOM.render(elt, container); } - beforeEach(function() { + beforeEach(() => { React = require('React'); ReactDOM = require('ReactDOM'); ReactDOMComponentTree = require('ReactDOMComponentTree'); ReactDOMServer = require('ReactDOMServer'); }); - it('finds nodes for instances', function() { + it('finds nodes for instances', () => { // This is a little hard to test directly. But refs rely on it -- so we // check that we can find a ref at arbitrary points in the tree, even if // other nodes don't have a ref. @@ -61,7 +61,7 @@ describe('ReactDOMComponentTree', function() { expect(renderAndGetRef('input')).toBe('INPUT'); }); - it('finds instances for nodes', function() { + it('finds instances for nodes', () => { class Component extends React.Component { render() { return ( diff --git a/src/renderers/dom/client/__tests__/ReactDOMIDOperations-test.js b/src/renderers/dom/client/__tests__/ReactDOMIDOperations-test.js index c00c230faf7b4..dffd62dae4a3d 100644 --- a/src/renderers/dom/client/__tests__/ReactDOMIDOperations-test.js +++ b/src/renderers/dom/client/__tests__/ReactDOMIDOperations-test.js @@ -11,11 +11,11 @@ 'use strict'; -describe('ReactDOMIDOperations', function() { +describe('ReactDOMIDOperations', () => { var ReactDOMComponentTree = require('ReactDOMComponentTree'); var ReactDOMIDOperations = require('ReactDOMIDOperations'); - it('should update innerHTML and preserve whitespace', function() { + it('should update innerHTML and preserve whitespace', () => { var stubNode = document.createElement('div'); var stubInstance = {_debugID: 1}; ReactDOMComponentTree.precacheNode(stubInstance, stubNode); diff --git a/src/renderers/dom/client/__tests__/ReactDOMSVG-test.js b/src/renderers/dom/client/__tests__/ReactDOMSVG-test.js index 84fb2711f42ab..30760d3ae88db 100644 --- a/src/renderers/dom/client/__tests__/ReactDOMSVG-test.js +++ b/src/renderers/dom/client/__tests__/ReactDOMSVG-test.js @@ -14,14 +14,14 @@ var React; var ReactDOMServer; -describe('ReactDOMSVG', function() { +describe('ReactDOMSVG', () => { - beforeEach(function() { + beforeEach(() => { React = require('React'); ReactDOMServer = require('ReactDOMServer'); }); - it('creates initial namespaced markup', function() { + it('creates initial namespaced markup', () => { var markup = ReactDOMServer.renderToString( diff --git a/src/renderers/dom/client/__tests__/ReactDOMTreeTraversal-test.js b/src/renderers/dom/client/__tests__/ReactDOMTreeTraversal-test.js index a3c88d48d5809..d6a51180274dd 100644 --- a/src/renderers/dom/client/__tests__/ReactDOMTreeTraversal-test.js +++ b/src/renderers/dom/client/__tests__/ReactDOMTreeTraversal-test.js @@ -50,7 +50,7 @@ function renderParentIntoDocument() { return ReactTestUtils.renderIntoDocument(); } -describe('ReactDOMTreeTraversal', function() { +describe('ReactDOMTreeTraversal', () => { var ReactDOMTreeTraversal; var aggregatedArgs; @@ -66,19 +66,19 @@ describe('ReactDOMTreeTraversal', function() { return ReactDOMComponentTree.getInstanceFromNode(node); } - beforeEach(function() { + beforeEach(() => { ReactDOMTreeTraversal = require('ReactDOMTreeTraversal'); aggregatedArgs = []; }); - describe('traverseTwoPhase', function() { - it('should not traverse when traversing outside DOM', function() { + describe('traverseTwoPhase', () => { + it('should not traverse when traversing outside DOM', () => { var expectedAggregation = []; ReactDOMTreeTraversal.traverseTwoPhase(null, argAggregator, ARG); expect(aggregatedArgs).toEqual(expectedAggregation); }); - it('should traverse two phase across component boundary', function() { + it('should traverse two phase across component boundary', () => { var parent = renderParentIntoDocument(); var target = getInst(parent.refs.P_P1_C1.refs.DIV_1); var expectedAggregation = [ @@ -96,7 +96,7 @@ describe('ReactDOMTreeTraversal', function() { expect(aggregatedArgs).toEqual(expectedAggregation); }); - it('should traverse two phase at shallowest node', function() { + it('should traverse two phase at shallowest node', () => { var parent = renderParentIntoDocument(); var target = getInst(parent.refs.P); var expectedAggregation = [ @@ -108,8 +108,8 @@ describe('ReactDOMTreeTraversal', function() { }); }); - describe('traverseEnterLeave', function() { - it('should not traverse when enter/leaving outside DOM', function() { + describe('traverseEnterLeave', () => { + it('should not traverse when enter/leaving outside DOM', () => { var target = null; var expectedAggregation = []; ReactDOMTreeTraversal.traverseEnterLeave( @@ -118,7 +118,7 @@ describe('ReactDOMTreeTraversal', function() { expect(aggregatedArgs).toEqual(expectedAggregation); }); - it('should not traverse if enter/leave the same node', function() { + it('should not traverse if enter/leave the same node', () => { var parent = renderParentIntoDocument(); var leave = getInst(parent.refs.P_P1_C1.refs.DIV_1); var enter = getInst(parent.refs.P_P1_C1.refs.DIV_1); @@ -129,7 +129,7 @@ describe('ReactDOMTreeTraversal', function() { expect(aggregatedArgs).toEqual(expectedAggregation); }); - it('should traverse enter/leave to sibling - avoids parent', function() { + it('should traverse enter/leave to sibling - avoids parent', () => { var parent = renderParentIntoDocument(); var leave = getInst(parent.refs.P_P1_C1.refs.DIV_1); var enter = getInst(parent.refs.P_P1_C1.refs.DIV_2); @@ -144,7 +144,7 @@ describe('ReactDOMTreeTraversal', function() { expect(aggregatedArgs).toEqual(expectedAggregation); }); - it('should traverse enter/leave to parent - avoids parent', function() { + it('should traverse enter/leave to parent - avoids parent', () => { var parent = renderParentIntoDocument(); var leave = getInst(parent.refs.P_P1_C1.refs.DIV_1); var enter = getInst(parent.refs.P_P1_C1.refs.DIV); @@ -157,7 +157,7 @@ describe('ReactDOMTreeTraversal', function() { expect(aggregatedArgs).toEqual(expectedAggregation); }); - it('should enter from the window', function() { + it('should enter from the window', () => { var parent = renderParentIntoDocument(); var leave = null; // From the window or outside of the React sandbox. var enter = getInst(parent.refs.P_P1_C1.refs.DIV); @@ -172,7 +172,7 @@ describe('ReactDOMTreeTraversal', function() { expect(aggregatedArgs).toEqual(expectedAggregation); }); - it('should enter from the window to the shallowest', function() { + it('should enter from the window to the shallowest', () => { var parent = renderParentIntoDocument(); var leave = null; // From the window or outside of the React sandbox. var enter = getInst(parent.refs.P); @@ -185,7 +185,7 @@ describe('ReactDOMTreeTraversal', function() { expect(aggregatedArgs).toEqual(expectedAggregation); }); - it('should leave to the window', function() { + it('should leave to the window', () => { var parent = renderParentIntoDocument(); var enter = null; // From the window or outside of the React sandbox. var leave = getInst(parent.refs.P_P1_C1.refs.DIV); @@ -200,7 +200,7 @@ describe('ReactDOMTreeTraversal', function() { expect(aggregatedArgs).toEqual(expectedAggregation); }); - it('should leave to the window from the shallowest', function() { + it('should leave to the window from the shallowest', () => { var parent = renderParentIntoDocument(); var enter = null; // From the window or outside of the React sandbox. var leave = getInst(parent.refs.P_P1_C1.refs.DIV); @@ -216,8 +216,8 @@ describe('ReactDOMTreeTraversal', function() { }); }); - describe('getFirstCommonAncestor', function() { - it('should determine the first common ancestor correctly', function() { + describe('getFirstCommonAncestor', () => { + it('should determine the first common ancestor correctly', () => { var parent = renderParentIntoDocument(); var ancestors = [ // Common ancestor with self is self. diff --git a/src/renderers/dom/client/__tests__/ReactEventIndependence-test.js b/src/renderers/dom/client/__tests__/ReactEventIndependence-test.js index e652e9e1ca6a9..695e1927b1952 100644 --- a/src/renderers/dom/client/__tests__/ReactEventIndependence-test.js +++ b/src/renderers/dom/client/__tests__/ReactEventIndependence-test.js @@ -15,8 +15,8 @@ var React; var ReactDOM; var ReactTestUtils; -describe('ReactEventIndependence', function() { - beforeEach(function() { +describe('ReactEventIndependence', () => { + beforeEach(() => { jest.resetModuleRegistry(); React = require('React'); @@ -24,7 +24,7 @@ describe('ReactEventIndependence', function() { ReactTestUtils = require('ReactTestUtils'); }); - it('does not crash with other react inside', function() { + it('does not crash with other react inside', () => { var clicks = 0; var div = ReactTestUtils.renderIntoDocument(
{ var clicks = 0; var outer = document.createElement('div'); outer.setAttribute('data-reactid', '.z'); @@ -50,7 +50,7 @@ describe('ReactEventIndependence', function() { expect(clicks).toBe(1); }); - it('does not when event fired on unmounted tree', function() { + it('does not when event fired on unmounted tree', () => { var clicks = 0; var container = document.createElement('div'); var button = ReactDOM.render( diff --git a/src/renderers/dom/client/__tests__/ReactEventListener-test.js b/src/renderers/dom/client/__tests__/ReactEventListener-test.js index b29d07b1900fd..f0fc24b9bc125 100644 --- a/src/renderers/dom/client/__tests__/ReactEventListener-test.js +++ b/src/renderers/dom/client/__tests__/ReactEventListener-test.js @@ -14,7 +14,7 @@ var EVENT_TARGET_PARAM = 1; -describe('ReactEventListener', function() { +describe('ReactEventListener', () => { var React; var ReactDOM; var ReactDOMComponentTree; @@ -22,7 +22,7 @@ describe('ReactEventListener', function() { var ReactTestUtils; var handleTopLevel; - beforeEach(function() { + beforeEach(() => { jest.resetModuleRegistry(); React = require('React'); ReactDOM = require('ReactDOM'); @@ -34,7 +34,7 @@ describe('ReactEventListener', function() { ReactEventListener._handleTopLevel = handleTopLevel; }); - it('should dispatch events from outside React tree', function() { + it('should dispatch events from outside React tree', () => { var otherNode = document.createElement('h1'); var component = ReactDOM.render(
, document.createElement('div')); expect(handleTopLevel.mock.calls.length).toBe(0); @@ -54,8 +54,8 @@ describe('ReactEventListener', function() { expect(handleTopLevel.mock.calls.length).toBe(1); }); - describe('Propagation', function() { - it('should propagate events one level down', function() { + describe('Propagation', () => { + it('should propagate events one level down', () => { var childContainer = document.createElement('div'); var childControl =
Child
; var parentContainer = document.createElement('div'); @@ -78,7 +78,7 @@ describe('ReactEventListener', function() { .toBe(ReactDOMComponentTree.getInstanceFromNode(parentControl)); }); - it('should propagate events two levels down', function() { + it('should propagate events two levels down', () => { var childContainer = document.createElement('div'); var childControl =
Child
; var parentContainer = document.createElement('div'); @@ -108,7 +108,7 @@ describe('ReactEventListener', function() { .toBe(ReactDOMComponentTree.getInstanceFromNode(grandParentControl)); }); - it('should not get confused by disappearing elements', function() { + it('should not get confused by disappearing elements', () => { var childContainer = document.createElement('div'); var childControl =
Child
; var parentContainer = document.createElement('div'); @@ -144,7 +144,7 @@ describe('ReactEventListener', function() { .toBe(ReactDOMComponentTree.getInstanceFromNode(parentControl)); }); - it('should batch between handlers from different roots', function() { + it('should batch between handlers from different roots', () => { var childContainer = document.createElement('div'); var parentContainer = document.createElement('div'); var childControl = ReactDOM.render( @@ -183,7 +183,7 @@ describe('ReactEventListener', function() { }); }); - it('should not fire duplicate events for a React DOM tree', function() { + it('should not fire duplicate events for a React DOM tree', () => { class Wrapper extends React.Component { getInner = () => { return this.refs.inner; diff --git a/src/renderers/dom/client/__tests__/ReactMount-test.js b/src/renderers/dom/client/__tests__/ReactMount-test.js index ca7453d8d9439..53538b4af0637 100644 --- a/src/renderers/dom/client/__tests__/ReactMount-test.js +++ b/src/renderers/dom/client/__tests__/ReactMount-test.js @@ -18,8 +18,8 @@ var ReactMount; var ReactTestUtils; var WebComponents; -describe('ReactMount', function() { - beforeEach(function() { +describe('ReactMount', () => { + beforeEach(() => { jest.resetModuleRegistry(); React = require('React'); @@ -39,8 +39,8 @@ describe('ReactMount', function() { } }); - describe('unmountComponentAtNode', function() { - it('throws when given a non-node', function() { + describe('unmountComponentAtNode', () => { + it('throws when given a non-node', () => { var nodeArray = document.getElementsByTagName('div'); expect(function() { ReactDOM.unmountComponentAtNode(nodeArray); @@ -50,7 +50,7 @@ describe('ReactMount', function() { }); }); - it('throws when given a string', function() { + it('throws when given a string', () => { expect(function() { ReactTestUtils.renderIntoDocument('div'); }).toThrowError( @@ -59,7 +59,7 @@ describe('ReactMount', function() { ); }); - it('throws when given a factory', function() { + it('throws when given a factory', () => { class Component extends React.Component { render() { return
; @@ -74,7 +74,7 @@ describe('ReactMount', function() { ); }); - it('should render different components in same root', function() { + it('should render different components in same root', () => { var container = document.createElement('container'); document.body.appendChild(container); @@ -85,7 +85,7 @@ describe('ReactMount', function() { expect(container.firstChild.nodeName).toBe('SPAN'); }); - it('should unmount and remount if the key changes', function() { + it('should unmount and remount if the key changes', () => { var container = document.createElement('container'); var mockMount = jest.fn(); @@ -120,7 +120,7 @@ describe('ReactMount', function() { expect(mockUnmount.mock.calls.length).toBe(1); }); - it('should reuse markup if rendering to the same target twice', function() { + it('should reuse markup if rendering to the same target twice', () => { var container = document.createElement('container'); var instance1 = ReactDOM.render(
, container); var instance2 = ReactDOM.render(
, container); @@ -128,7 +128,7 @@ describe('ReactMount', function() { expect(instance1 === instance2).toBe(true); }); - it('should warn if mounting into dirty rendered markup', function() { + it('should warn if mounting into dirty rendered markup', () => { var container = document.createElement('container'); container.innerHTML = ReactDOMServer.renderToString(
) + ' '; @@ -142,7 +142,7 @@ describe('ReactMount', function() { expect(console.error.calls.count()).toBe(2); }); - it('should not warn if mounting into non-empty node', function() { + it('should not warn if mounting into non-empty node', () => { var container = document.createElement('container'); container.innerHTML = '
'; @@ -151,7 +151,7 @@ describe('ReactMount', function() { expect(console.error.calls.count()).toBe(0); }); - it('should warn when mounting into document.body', function() { + it('should warn when mounting into document.body', () => { var iFrame = document.createElement('iframe'); document.body.appendChild(iFrame); spyOn(console, 'error'); @@ -164,7 +164,7 @@ describe('ReactMount', function() { ); }); - it('should account for escaping on a checksum mismatch', function() { + it('should account for escaping on a checksum mismatch', () => { var div = document.createElement('div'); var markup = ReactDOMServer.renderToString(
This markup contains an nbsp entity:   server text
); @@ -183,7 +183,7 @@ describe('ReactMount', function() { }); if (WebComponents !== undefined) { - it('should allow mounting/unmounting to document fragment container', function() { + it('should allow mounting/unmounting to document fragment container', () => { var shadowRoot; var proto = Object.create(HTMLElement.prototype, { createdCallback: { @@ -205,7 +205,7 @@ describe('ReactMount', function() { }); } - it('should warn if render removes React-rendered children', function() { + it('should warn if render removes React-rendered children', () => { var container = document.createElement('container'); class Component extends React.Component { @@ -229,7 +229,7 @@ describe('ReactMount', function() { ); }); - it('should warn if the unmounted node was rendered by another copy of React', function() { + it('should warn if the unmounted node was rendered by another copy of React', () => { jest.resetModuleRegistry(); var ReactDOMOther = require('ReactDOM'); var container = document.createElement('div'); @@ -257,7 +257,7 @@ describe('ReactMount', function() { expect(console.error.calls.count()).toBe(1); }); - it('passes the correct callback context', function() { + it('passes the correct callback context', () => { var container = document.createElement('div'); var calls = 0; @@ -297,7 +297,7 @@ describe('ReactMount', function() { expect(calls).toBe(5); }); - it('tracks root instances', function() { + it('tracks root instances', () => { // Used by devtools. expect(Object.keys(ReactMount._instancesByReactRootID).length).toBe(0); ReactTestUtils.renderIntoDocument(); @@ -309,7 +309,7 @@ describe('ReactMount', function() { expect(Object.keys(ReactMount._instancesByReactRootID).length).toBe(1); }); - it('marks top-level mounts', function() { + it('marks top-level mounts', () => { var ReactFeatureFlags = require('ReactFeatureFlags'); class Foo extends React.Component { diff --git a/src/renderers/dom/client/__tests__/ReactMountDestruction-test.js b/src/renderers/dom/client/__tests__/ReactMountDestruction-test.js index c86d79bd44c48..6068d99339ba7 100644 --- a/src/renderers/dom/client/__tests__/ReactMountDestruction-test.js +++ b/src/renderers/dom/client/__tests__/ReactMountDestruction-test.js @@ -14,8 +14,8 @@ var React = require('React'); var ReactDOM = require('ReactDOM'); -describe('ReactMount', function() { - it('should destroy a react root upon request', function() { +describe('ReactMount', () => { + it('should destroy a react root upon request', () => { var mainContainerDiv = document.createElement('div'); document.body.appendChild(mainContainerDiv); @@ -40,7 +40,7 @@ describe('ReactMount', function() { expect(secondRootDiv.firstChild).toBeNull(); }); - it('should warn when unmounting a non-container root node', function() { + it('should warn when unmounting a non-container root node', () => { var mainContainerDiv = document.createElement('div'); var component = @@ -62,7 +62,7 @@ describe('ReactMount', function() { ); }); - it('should warn when unmounting a non-container, non-root node', function() { + it('should warn when unmounting a non-container, non-root node', () => { var mainContainerDiv = document.createElement('div'); var component = diff --git a/src/renderers/dom/client/__tests__/ReactRenderDocument-test.js b/src/renderers/dom/client/__tests__/ReactRenderDocument-test.js index 496f0ce4e21ce..473bf9c76b41e 100644 --- a/src/renderers/dom/client/__tests__/ReactRenderDocument-test.js +++ b/src/renderers/dom/client/__tests__/ReactRenderDocument-test.js @@ -26,8 +26,8 @@ var UNMOUNT_INVARIANT_MESSAGE = 'efficiently. To fix this, have a single top-level component that ' + 'never unmounts render these elements.'; -describe('rendering React components at document', function() { - beforeEach(function() { +describe('rendering React components at document', () => { + beforeEach(() => { jest.resetModuleRegistry(); React = require('React'); @@ -38,7 +38,7 @@ describe('rendering React components at document', function() { testDocument = getTestDocument(); }); - it('should be able to adopt server markup', function() { + it('should be able to adopt server markup', () => { expect(testDocument).not.toBeUndefined(); class Root extends React.Component { @@ -69,7 +69,7 @@ describe('rendering React components at document', function() { expect(body).toBe(testDocument.body); }); - it('should not be able to unmount component from document node', function() { + it('should not be able to unmount component from document node', () => { expect(testDocument).not.toBeUndefined(); class Root extends React.Component { @@ -99,7 +99,7 @@ describe('rendering React components at document', function() { expect(testDocument.body.innerHTML).toBe('Hello world'); }); - it('should not be able to switch root constructors', function() { + it('should not be able to switch root constructors', () => { expect(testDocument).not.toBeUndefined(); class Component extends React.Component { @@ -147,7 +147,7 @@ describe('rendering React components at document', function() { expect(testDocument.body.innerHTML).toBe('Hello world'); }); - it('should be able to mount into document', function() { + it('should be able to mount into document', () => { expect(testDocument).not.toBeUndefined(); class Component extends React.Component { @@ -175,7 +175,7 @@ describe('rendering React components at document', function() { expect(testDocument.body.innerHTML).toBe('Hello world'); }); - it('should give helpful errors on state desync', function() { + it('should give helpful errors on state desync', () => { expect(testDocument).not.toBeUndefined(); class Component extends React.Component { @@ -215,7 +215,7 @@ describe('rendering React components at document', function() { ); }); - it('should throw on full document render w/ no markup', function() { + it('should throw on full document render w/ no markup', () => { expect(testDocument).not.toBeUndefined(); var container = testDocument; @@ -245,7 +245,7 @@ describe('rendering React components at document', function() { ); }); - it('supports findDOMNode on full-page components', function() { + it('supports findDOMNode on full-page components', () => { var tree = diff --git a/src/renderers/dom/client/__tests__/findDOMNode-test.js b/src/renderers/dom/client/__tests__/findDOMNode-test.js index 6c3b35da0664f..05b76d4fba022 100644 --- a/src/renderers/dom/client/__tests__/findDOMNode-test.js +++ b/src/renderers/dom/client/__tests__/findDOMNode-test.js @@ -15,12 +15,12 @@ var React = require('React'); var ReactDOM = require('ReactDOM'); var ReactTestUtils = require('ReactTestUtils'); -describe('findDOMNode', function() { - it('findDOMNode should return null if passed null', function() { +describe('findDOMNode', () => { + it('findDOMNode should return null if passed null', () => { expect(ReactDOM.findDOMNode(null)).toBe(null); }); - it('findDOMNode should find dom element', function() { + it('findDOMNode should find dom element', () => { class MyNode extends React.Component { render() { return
Noise
; @@ -34,7 +34,7 @@ describe('findDOMNode', function() { expect(mySameDiv).toBe(myDiv); }); - it('findDOMNode should reject random objects', function() { + it('findDOMNode should reject random objects', () => { expect(function() { ReactDOM.findDOMNode({foo: 'bar'}); }).toThrowError( @@ -42,7 +42,7 @@ describe('findDOMNode', function() { ); }); - it('findDOMNode should reject unmounted objects with render func', function() { + it('findDOMNode should reject unmounted objects with render func', () => { class Foo extends React.Component { render() { return
; @@ -58,7 +58,7 @@ describe('findDOMNode', function() { ); }); - it('findDOMNode should not throw an error when called within a component that is not mounted', function() { + it('findDOMNode should not throw an error when called within a component that is not mounted', () => { class Bar extends React.Component { componentWillMount() { expect(ReactDOM.findDOMNode(this)).toBeNull(); diff --git a/src/renderers/dom/client/__tests__/inputValueTracking-test.js b/src/renderers/dom/client/__tests__/inputValueTracking-test.js index e9f42a1444c99..9be2c5eca47c7 100644 --- a/src/renderers/dom/client/__tests__/inputValueTracking-test.js +++ b/src/renderers/dom/client/__tests__/inputValueTracking-test.js @@ -14,10 +14,10 @@ var React = require('React'); var ReactTestUtils = require('ReactTestUtils'); var inputValueTracking = require('inputValueTracking'); -describe('inputValueTracking', function() { +describe('inputValueTracking', () => { var input, checkbox, mockComponent; - beforeEach(function() { + beforeEach(() => { input = document.createElement('input'); input.type = 'text'; checkbox = document.createElement('input'); @@ -25,7 +25,7 @@ describe('inputValueTracking', function() { mockComponent = { _hostNode: input, _wrapperState: {} }; }); - it('should attach tracker to wrapper state', function() { + it('should attach tracker to wrapper state', () => { inputValueTracking.track(mockComponent); expect( @@ -33,7 +33,7 @@ describe('inputValueTracking', function() { ).toBe(true); }); - it('should define `value` on the instance node', function() { + it('should define `value` on the instance node', () => { inputValueTracking.track(mockComponent); expect( @@ -41,14 +41,14 @@ describe('inputValueTracking', function() { ).toBe(true); }); - it('should define `checked` on the instance node', function() { + it('should define `checked` on the instance node', () => { mockComponent._hostNode = checkbox; inputValueTracking.track(mockComponent); expect(checkbox.hasOwnProperty('checked')).toBe(true); }); - it('should initialize with the current value', function() { + it('should initialize with the current value', () => { input.value ='foo'; inputValueTracking.track(mockComponent); @@ -58,7 +58,7 @@ describe('inputValueTracking', function() { expect(tracker.getValue()).toEqual('foo'); }); - it('should initialize with the current `checked`', function() { + it('should initialize with the current `checked`', () => { mockComponent._hostNode = checkbox; checkbox.checked = true; inputValueTracking.track(mockComponent); @@ -68,7 +68,7 @@ describe('inputValueTracking', function() { expect(tracker.getValue()).toEqual('true'); }); - it('should track value changes', function() { + it('should track value changes', () => { input.value ='foo'; inputValueTracking.track(mockComponent); @@ -79,7 +79,7 @@ describe('inputValueTracking', function() { expect(tracker.getValue()).toEqual('bar'); }); - it('should tracked`checked` changes', function() { + it('should tracked`checked` changes', () => { mockComponent._hostNode = checkbox; checkbox.checked = true; inputValueTracking.track(mockComponent); @@ -90,7 +90,7 @@ describe('inputValueTracking', function() { expect(tracker.getValue()).toEqual('false'); }); - it('should update value manually', function() { + it('should update value manually', () => { input.value ='foo'; inputValueTracking.track(mockComponent); @@ -100,7 +100,7 @@ describe('inputValueTracking', function() { expect(tracker.getValue()).toEqual('bar'); }); - it('should coerce value to a string', function() { + it('should coerce value to a string', () => { input.value ='foo'; inputValueTracking.track(mockComponent); @@ -110,7 +110,7 @@ describe('inputValueTracking', function() { expect(tracker.getValue()).toEqual('500'); }); - it('should update value if it changed and return result', function() { + it('should update value if it changed and return result', () => { inputValueTracking.track(mockComponent); input.value ='foo'; @@ -129,7 +129,7 @@ describe('inputValueTracking', function() { expect(tracker.getValue()).toEqual('foo'); }); - it('should track value and return true when updating untracked instance', function() { + it('should track value and return true when updating untracked instance', () => { input.value ='foo'; expect( @@ -141,13 +141,13 @@ describe('inputValueTracking', function() { expect(tracker.getValue()).toEqual('foo'); }); - it('should return tracker from node', function() { + it('should return tracker from node', () => { var node = ReactTestUtils.renderIntoDocument(); var tracker = inputValueTracking._getTrackerFromNode(node); expect(tracker.getValue()).toEqual('foo'); }); - it('should stop tracking', function() { + it('should stop tracking', () => { inputValueTracking.track(mockComponent); expect( diff --git a/src/renderers/dom/client/__tests__/validateDOMNesting-test.js b/src/renderers/dom/client/__tests__/validateDOMNesting-test.js index dec17ae4ba288..5f0afa5cb9063 100644 --- a/src/renderers/dom/client/__tests__/validateDOMNesting-test.js +++ b/src/renderers/dom/client/__tests__/validateDOMNesting-test.js @@ -45,14 +45,14 @@ function isTagStackValid(stack) { return true; } -describe('ReactContextValidator', function() { - beforeEach(function() { +describe('ReactContextValidator', () => { + beforeEach(() => { jest.resetModuleRegistry(); validateDOMNesting = require('validateDOMNesting'); }); - it('allows any tag with no context', function() { + it('allows any tag with no context', () => { // With renderToString (for example), we don't know where we're mounting the // tag so we must err on the side of leniency. var allTags = [].concat(specialTags, formattingTags, ['mysterytag']); @@ -61,7 +61,7 @@ describe('ReactContextValidator', function() { }); }); - it('allows valid nestings', function() { + it('allows valid nestings', () => { expect(isTagStackValid(['table', 'tbody', 'tr', 'td', 'b'])).toBe(true); expect(isTagStackValid(['body', 'datalist', 'option'])).toBe(true); expect(isTagStackValid(['div', 'a', 'object', 'a'])).toBe(true); @@ -76,7 +76,7 @@ describe('ReactContextValidator', function() { expect(isTagStackValid(['div', 'ul', 'li', 'dd', 'li'])).toBe(true); }); - it('prevents problematic nestings', function() { + it('prevents problematic nestings', () => { expect(isTagStackValid(['a', 'a'])).toBe(false); expect(isTagStackValid(['form', 'form'])).toBe(false); expect(isTagStackValid(['p', 'p'])).toBe(false); diff --git a/src/renderers/dom/client/eventPlugins/__tests__/ChangeEventPlugin-test.js b/src/renderers/dom/client/eventPlugins/__tests__/ChangeEventPlugin-test.js index a30d525814ae7..efe04b0874af4 100644 --- a/src/renderers/dom/client/eventPlugins/__tests__/ChangeEventPlugin-test.js +++ b/src/renderers/dom/client/eventPlugins/__tests__/ChangeEventPlugin-test.js @@ -39,8 +39,8 @@ function setUntrackedValue(elem, value) { tracker.setValue(current); } -describe('ChangeEventPlugin', function() { - it('should fire change for checkbox input', function() { +describe('ChangeEventPlugin', () => { + it('should fire change for checkbox input', () => { var called = 0; function cb(e) { @@ -56,7 +56,7 @@ describe('ChangeEventPlugin', function() { expect(called).toBe(1); }); - it('should catch setting the value programmatically', function() { + it('should catch setting the value programmatically', () => { var input = ReactTestUtils.renderIntoDocument( ); @@ -65,7 +65,7 @@ describe('ChangeEventPlugin', function() { expect(getTrackedValue(input)).toBe('bar'); }); - it('should not fire change when setting the value programmatically', function() { + it('should not fire change when setting the value programmatically', () => { var called = 0; function cb(e) { @@ -87,7 +87,7 @@ describe('ChangeEventPlugin', function() { expect(called).toBe(1); }); - it('should not fire change when setting checked programmatically', function() { + it('should not fire change when setting checked programmatically', () => { var called = 0; function cb(e) { @@ -110,14 +110,14 @@ describe('ChangeEventPlugin', function() { expect(called).toBe(1); }); - it('should unmount', function() { + it('should unmount', () => { var container = document.createElement('div'); var input = ReactDOM.render(, container); ReactDOM.unmountComponentAtNode(container); }); - it('should only fire change for checked radio button once', function() { + it('should only fire change for checked radio button once', () => { var called = 0; function cb(e) { @@ -131,7 +131,7 @@ describe('ChangeEventPlugin', function() { expect(called).toBe(1); }); - it('should deduplicate input value change events', function() { + it('should deduplicate input value change events', () => { var input; var called = 0; @@ -169,7 +169,7 @@ describe('ChangeEventPlugin', function() { }); }); - it('should listen for both change and input events when supported', function() { + it('should listen for both change and input events when supported', () => { var called = 0; function cb(e) { @@ -193,7 +193,7 @@ describe('ChangeEventPlugin', function() { expect(called).toBe(2); }); - it('should only fire events when the value changes for range inputs', function() { + it('should only fire events when the value changes for range inputs', () => { var called = 0; function cb(e) { diff --git a/src/renderers/dom/client/eventPlugins/__tests__/EnterLeaveEventPlugin-test.js b/src/renderers/dom/client/eventPlugins/__tests__/EnterLeaveEventPlugin-test.js index 46ab24f51aa2a..f856cf320f625 100644 --- a/src/renderers/dom/client/eventPlugins/__tests__/EnterLeaveEventPlugin-test.js +++ b/src/renderers/dom/client/eventPlugins/__tests__/EnterLeaveEventPlugin-test.js @@ -16,8 +16,8 @@ var React; var ReactDOM; var ReactDOMComponentTree; -describe('EnterLeaveEventPlugin', function() { - beforeEach(function() { +describe('EnterLeaveEventPlugin', () => { + beforeEach(() => { jest.resetModuleRegistry(); EnterLeaveEventPlugin = require('EnterLeaveEventPlugin'); @@ -26,7 +26,7 @@ describe('EnterLeaveEventPlugin', function() { ReactDOMComponentTree = require('ReactDOMComponentTree'); }); - it('should set relatedTarget properly in iframe', function() { + it('should set relatedTarget properly in iframe', () => { var iframe = document.createElement('iframe'); document.body.appendChild(iframe); diff --git a/src/renderers/dom/client/eventPlugins/__tests__/FallbackCompositionState-test.js b/src/renderers/dom/client/eventPlugins/__tests__/FallbackCompositionState-test.js index 04e09ea289724..35eca38ac933d 100644 --- a/src/renderers/dom/client/eventPlugins/__tests__/FallbackCompositionState-test.js +++ b/src/renderers/dom/client/eventPlugins/__tests__/FallbackCompositionState-test.js @@ -11,12 +11,12 @@ 'use strict'; -describe('FallbackCompositionState', function() { +describe('FallbackCompositionState', () => { var FallbackCompositionState; var TEXT = 'Hello world'; - beforeEach(function() { + beforeEach(() => { FallbackCompositionState = require('FallbackCompositionState'); }); @@ -48,7 +48,7 @@ describe('FallbackCompositionState', function() { FallbackCompositionState.release(composition); } - it('extracts value via `getText()`', function() { + it('extracts value via `getText()`', () => { var composition = FallbackCompositionState.getPooled(getInput()); expect(composition.getText()).toBe(TEXT); FallbackCompositionState.release(composition); @@ -62,30 +62,30 @@ describe('FallbackCompositionState', function() { FallbackCompositionState.release(composition); }); - describe('Extract fallback data inserted at collapsed cursor', function() { - it('extracts when inserted at start of text', function() { + describe('Extract fallback data inserted at collapsed cursor', () => { + it('extracts when inserted at start of text', () => { assertExtractedData('XXXHello world', 'XXX'); }); - it('extracts when inserted within text', function() { + it('extracts when inserted within text', () => { assertExtractedData('Hello XXXworld', 'XXX'); }); - it('extracts when inserted at end of text', function() { + it('extracts when inserted at end of text', () => { assertExtractedData('Hello worldXXX', 'XXX'); }); }); - describe('Extract fallback data for non-collapsed range', function() { - it('extracts when inserted at start of text', function() { + describe('Extract fallback data for non-collapsed range', () => { + it('extracts when inserted at start of text', () => { assertExtractedData('XXX world', 'XXX'); }); - it('extracts when inserted within text', function() { + it('extracts when inserted within text', () => { assertExtractedData('HelXXXrld', 'XXX'); }); - it('extracts when inserted at end of text', function() { + it('extracts when inserted at end of text', () => { assertExtractedData('Hello XXX', 'XXX'); }); }); diff --git a/src/renderers/dom/client/eventPlugins/__tests__/SelectEventPlugin-test.js b/src/renderers/dom/client/eventPlugins/__tests__/SelectEventPlugin-test.js index f592df51f1f69..d8d79f7082250 100644 --- a/src/renderers/dom/client/eventPlugins/__tests__/SelectEventPlugin-test.js +++ b/src/renderers/dom/client/eventPlugins/__tests__/SelectEventPlugin-test.js @@ -17,7 +17,7 @@ var ReactDOMComponentTree; var ReactTestUtils; var SelectEventPlugin; -describe('SelectEventPlugin', function() { +describe('SelectEventPlugin', () => { function extract(node, topLevelEvent) { return SelectEventPlugin.extractEvents( topLevelEvent, @@ -27,7 +27,7 @@ describe('SelectEventPlugin', function() { ); } - beforeEach(function() { + beforeEach(() => { React = require('React'); ReactDOM = require('ReactDOM'); ReactDOMComponentTree = require('ReactDOMComponentTree'); @@ -35,7 +35,7 @@ describe('SelectEventPlugin', function() { SelectEventPlugin = require('SelectEventPlugin'); }); - it('should skip extraction if no listeners are present', function() { + it('should skip extraction if no listeners are present', () => { class WithoutSelect extends React.Component { render() { return ; @@ -53,7 +53,7 @@ describe('SelectEventPlugin', function() { expect(mouseup).toBe(null); }); - it('should extract if an `onSelect` listener is present', function() { + it('should extract if an `onSelect` listener is present', () => { class WithSelect extends React.Component { render() { return ; diff --git a/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticClipboardEvent-test.js b/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticClipboardEvent-test.js index 7776f54200346..8d82415454031 100644 --- a/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticClipboardEvent-test.js +++ b/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticClipboardEvent-test.js @@ -13,10 +13,10 @@ var SyntheticClipboardEvent; -describe('SyntheticClipboardEvent', function() { +describe('SyntheticClipboardEvent', () => { var createEvent; - beforeEach(function() { + beforeEach(() => { SyntheticClipboardEvent = require('SyntheticClipboardEvent'); createEvent = function(nativeEvent) { var target = require('getEventTarget')(nativeEvent); @@ -24,10 +24,10 @@ describe('SyntheticClipboardEvent', function() { }; }); - describe('ClipboardEvent interface', function() { - describe('clipboardData', function() { - describe('when event has clipboardData', function() { - it("returns event's clipboardData", function() { + describe('ClipboardEvent interface', () => { + describe('clipboardData', () => { + describe('when event has clipboardData', () => { + it("returns event's clipboardData", () => { // Mock clipboardData since native implementation doesn't have a constructor var clipboardData = jasmine.createSpyObj( 'clipboardData', @@ -41,8 +41,8 @@ describe('SyntheticClipboardEvent', function() { }); }); - describe('EventInterface', function() { - it('normalizes properties from the Event interface', function() { + describe('EventInterface', () => { + it('normalizes properties from the Event interface', () => { var target = document.createElement('div'); var syntheticEvent = createEvent({srcElement: target}); @@ -50,7 +50,7 @@ describe('SyntheticClipboardEvent', function() { expect(syntheticEvent.type).toBe(undefined); }); - it('is able to `preventDefault` and `stopPropagation`', function() { + it('is able to `preventDefault` and `stopPropagation`', () => { var nativeEvent = {}; var syntheticEvent = createEvent(nativeEvent); @@ -63,7 +63,7 @@ describe('SyntheticClipboardEvent', function() { expect(syntheticEvent.isPropagationStopped()).toBe(true); }); - it('is able to `persist`', function() { + it('is able to `persist`', () => { var syntheticEvent = createEvent({}); expect(syntheticEvent.isPersistent()).toBe(false); diff --git a/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticEvent-test.js b/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticEvent-test.js index 98f1690efda2b..f54d45411e8c8 100644 --- a/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticEvent-test.js +++ b/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticEvent-test.js @@ -16,10 +16,10 @@ var React; var ReactDOM; var ReactTestUtils; -describe('SyntheticEvent', function() { +describe('SyntheticEvent', () => { var createEvent; - beforeEach(function() { + beforeEach(() => { SyntheticEvent = require('SyntheticEvent'); React = require('React'); ReactDOM = require('ReactDOM'); @@ -31,7 +31,7 @@ describe('SyntheticEvent', function() { }; }); - it('should normalize `target` from the nativeEvent', function() { + it('should normalize `target` from the nativeEvent', () => { var target = document.createElement('div'); var syntheticEvent = createEvent({srcElement: target}); @@ -39,7 +39,7 @@ describe('SyntheticEvent', function() { expect(syntheticEvent.type).toBe(undefined); }); - it('should be able to `preventDefault`', function() { + it('should be able to `preventDefault`', () => { var nativeEvent = {}; var syntheticEvent = createEvent(nativeEvent); @@ -52,14 +52,14 @@ describe('SyntheticEvent', function() { expect(nativeEvent.returnValue).toBe(false); }); - it('should be prevented if nativeEvent is prevented', function() { + it('should be prevented if nativeEvent is prevented', () => { expect( createEvent({defaultPrevented: true}).isDefaultPrevented() ).toBe(true); expect(createEvent({returnValue: false}).isDefaultPrevented()).toBe(true); }); - it('should be able to `stopPropagation`', function() { + it('should be able to `stopPropagation`', () => { var nativeEvent = {}; var syntheticEvent = createEvent(nativeEvent); @@ -70,7 +70,7 @@ describe('SyntheticEvent', function() { expect(nativeEvent.cancelBubble).toBe(true); }); - it('should be able to `persist`', function() { + it('should be able to `persist`', () => { var syntheticEvent = createEvent({}); expect(syntheticEvent.isPersistent()).toBe(false); @@ -78,7 +78,7 @@ describe('SyntheticEvent', function() { expect(syntheticEvent.isPersistent()).toBe(true); }); - it('should be nullified if the synthetic event has called destructor and log warnings', function() { + it('should be nullified if the synthetic event has called destructor and log warnings', () => { spyOn(console, 'error'); var target = document.createElement('div'); var syntheticEvent = createEvent({srcElement: target}); @@ -98,7 +98,7 @@ describe('SyntheticEvent', function() { ); }); - it('should warn when setting properties of a destructored synthetic event', function() { + it('should warn when setting properties of a destructored synthetic event', () => { spyOn(console, 'error'); var target = document.createElement('div'); var syntheticEvent = createEvent({srcElement: target}); @@ -114,7 +114,7 @@ describe('SyntheticEvent', function() { ); }); - it('should warn if the synthetic event has been released when calling `preventDefault`', function() { + it('should warn if the synthetic event has been released when calling `preventDefault`', () => { spyOn(console, 'error'); var syntheticEvent = createEvent({}); SyntheticEvent.release(syntheticEvent); @@ -129,7 +129,7 @@ describe('SyntheticEvent', function() { ); }); - it('should warn if the synthetic event has been released when calling `stopPropagation`', function() { + it('should warn if the synthetic event has been released when calling `stopPropagation`', () => { spyOn(console, 'error'); var syntheticEvent = createEvent({}); SyntheticEvent.release(syntheticEvent); @@ -147,7 +147,7 @@ describe('SyntheticEvent', function() { // TODO: reenable this test. We are currently silencing these warnings when // using TestUtils.Simulate to avoid spurious warnings that result from the // way we simulate events. - xit('should properly log warnings when events simulated with rendered components', function() { + xit('should properly log warnings when events simulated with rendered components', () => { spyOn(console, 'error'); var event; var element = document.createElement('div'); @@ -171,7 +171,7 @@ describe('SyntheticEvent', function() { ); }); - it('should warn if Proxy is supported and the synthetic event is added a property', function() { + it('should warn if Proxy is supported and the synthetic event is added a property', () => { spyOn(console, 'error'); var syntheticEvent = createEvent({}); syntheticEvent.foo = 'bar'; diff --git a/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticKeyboardEvent-test.js b/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticKeyboardEvent-test.js index 9c75a7096408a..3b433e91842b0 100644 --- a/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticKeyboardEvent-test.js +++ b/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticKeyboardEvent-test.js @@ -14,10 +14,10 @@ var SyntheticKeyboardEvent; var getEventCharCode; -describe('SyntheticKeyboardEvent', function() { +describe('SyntheticKeyboardEvent', () => { var createEvent; - beforeEach(function() { + beforeEach(() => { // Mock getEventCharCode for proper unit testing jest.mock('getEventCharCode'); getEventCharCode = require('getEventCharCode'); @@ -29,10 +29,10 @@ describe('SyntheticKeyboardEvent', function() { }; }); - describe('KeyboardEvent interface', function() { - describe('charCode', function() { - describe('when event is `keypress`', function() { - it('returns whatever getEventCharCode returns', function() { + describe('KeyboardEvent interface', () => { + describe('charCode', () => { + describe('when event is `keypress`', () => { + it('returns whatever getEventCharCode returns', () => { getEventCharCode.mockReturnValue(100500); var keyboardEvent = createEvent({type: 'keypress', charCode: 50}); @@ -40,33 +40,33 @@ describe('SyntheticKeyboardEvent', function() { }); }); - describe('when event is not `keypress`', function() { - it('returns 0', function() { + describe('when event is not `keypress`', () => { + it('returns 0', () => { var keyboardEvent = createEvent({type: 'keyup', charCode: 50}); expect(keyboardEvent.charCode).toBe(0); }); }); }); - describe('keyCode', function() { - describe('when event is `keydown` or `keyup`', function() { - it('returns a passed keyCode', function() { + describe('keyCode', () => { + describe('when event is `keydown` or `keyup`', () => { + it('returns a passed keyCode', () => { var keyboardEvent = createEvent({type: 'keyup', keyCode: 40}); expect(keyboardEvent.keyCode).toBe(40); }); }); - describe('when event is `keypress`', function() { - it('returns 0', function() { + describe('when event is `keypress`', () => { + it('returns 0', () => { var keyboardEvent = createEvent({type: 'keypress', charCode: 40}); expect(keyboardEvent.keyCode).toBe(0); }); }); }); - describe('which', function() { - describe('when event is `keypress`', function() { - it('returns whatever getEventCharCode returns', function() { + describe('which', () => { + describe('when event is `keypress`', () => { + it('returns whatever getEventCharCode returns', () => { getEventCharCode.mockReturnValue(9001); var keyboardEvent = createEvent({type: 'keypress', charCode: 50}); @@ -74,15 +74,15 @@ describe('SyntheticKeyboardEvent', function() { }); }); - describe('when event is `keydown` or `keyup`', function() { - it('returns a passed keyCode', function() { + describe('when event is `keydown` or `keyup`', () => { + it('returns a passed keyCode', () => { var keyboardEvent = createEvent({type: 'keyup', keyCode: 40}); expect(keyboardEvent.which).toBe(40); }); }); - describe('when event type is unknown', function() { - it('returns 0', function() { + describe('when event type is unknown', () => { + it('returns 0', () => { var keyboardEvent = createEvent({type: 'keysmack', keyCode: 40}); expect(keyboardEvent.which).toBe(0); }); @@ -90,8 +90,8 @@ describe('SyntheticKeyboardEvent', function() { }); }); - describe('EventInterface', function() { - it('normalizes properties from the Event interface', function() { + describe('EventInterface', () => { + it('normalizes properties from the Event interface', () => { var target = document.createElement('div'); var syntheticEvent = createEvent({srcElement: target}); @@ -99,7 +99,7 @@ describe('SyntheticKeyboardEvent', function() { expect(syntheticEvent.type).toBe(undefined); }); - it('is able to `preventDefault` and `stopPropagation`', function() { + it('is able to `preventDefault` and `stopPropagation`', () => { var nativeEvent = {}; var syntheticEvent = createEvent(nativeEvent); @@ -112,7 +112,7 @@ describe('SyntheticKeyboardEvent', function() { expect(syntheticEvent.isPropagationStopped()).toBe(true); }); - it('is able to `persist`', function() { + it('is able to `persist`', () => { var syntheticEvent = createEvent({}); expect(syntheticEvent.isPersistent()).toBe(false); diff --git a/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticWheelEvent-test.js b/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticWheelEvent-test.js index 6ad4b488c06a6..74cc43120e73d 100644 --- a/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticWheelEvent-test.js +++ b/src/renderers/dom/client/syntheticEvents/__tests__/SyntheticWheelEvent-test.js @@ -13,10 +13,10 @@ var SyntheticWheelEvent; -describe('SyntheticWheelEvent', function() { +describe('SyntheticWheelEvent', () => { var createEvent; - beforeEach(function() { + beforeEach(() => { SyntheticWheelEvent = require('SyntheticWheelEvent'); createEvent = function(nativeEvent) { @@ -25,7 +25,7 @@ describe('SyntheticWheelEvent', function() { }; }); - it('should normalize properties from the Event interface', function() { + it('should normalize properties from the Event interface', () => { var target = document.createElement('div'); var syntheticEvent = createEvent({srcElement: target}); @@ -33,11 +33,11 @@ describe('SyntheticWheelEvent', function() { expect(syntheticEvent.type).toBe(undefined); }); - it('should normalize properties from the MouseEvent interface', function() { + it('should normalize properties from the MouseEvent interface', () => { expect(createEvent({which: 2, button: 1}).button).toBe(1); }); - it('should normalize properties from the WheelEvent interface', function() { + it('should normalize properties from the WheelEvent interface', () => { var standardEvent = createEvent({deltaX: 10, deltaY: -50}); expect(standardEvent.deltaX).toBe(10); expect(standardEvent.deltaY).toBe(-50); @@ -47,7 +47,7 @@ describe('SyntheticWheelEvent', function() { expect(webkitEvent.deltaY).toBe(-50); }); - it('should be able to `preventDefault` and `stopPropagation`', function() { + it('should be able to `preventDefault` and `stopPropagation`', () => { var nativeEvent = {}; var syntheticEvent = createEvent(nativeEvent); @@ -60,7 +60,7 @@ describe('SyntheticWheelEvent', function() { expect(syntheticEvent.isPropagationStopped()).toBe(true); }); - it('should be able to `persist`', function() { + it('should be able to `persist`', () => { var syntheticEvent = createEvent({}); expect(syntheticEvent.isPersistent()).toBe(false); diff --git a/src/renderers/dom/client/utils/__tests__/getEventCharCode-test.js b/src/renderers/dom/client/utils/__tests__/getEventCharCode-test.js index c375ffa15b208..64ed9214def9e 100644 --- a/src/renderers/dom/client/utils/__tests__/getEventCharCode-test.js +++ b/src/renderers/dom/client/utils/__tests__/getEventCharCode-test.js @@ -13,10 +13,10 @@ var getEventCharCode = require('getEventCharCode'); -describe('getEventCharCode', function() { - describe('when charCode is present in nativeEvent', function() { - describe('when charCode is 0 and keyCode is 13', function() { - it('returns 13', function() { +describe('getEventCharCode', () => { + describe('when charCode is present in nativeEvent', () => { + describe('when charCode is 0 and keyCode is 13', () => { + it('returns 13', () => { var nativeEvent = new KeyboardEvent( 'keypress', {charCode: 0, keyCode: 13} ); @@ -25,26 +25,26 @@ describe('getEventCharCode', function() { }); }); - describe('when charCode is not 0 and/or keyCode is not 13', function() { - describe('when charCode is 32 or bigger', function() { - it('returns charCode', function() { + describe('when charCode is not 0 and/or keyCode is not 13', () => { + describe('when charCode is 32 or bigger', () => { + it('returns charCode', () => { var nativeEvent = new KeyboardEvent('keypress', {charCode: 32}); expect(getEventCharCode(nativeEvent)).toBe(32); }); }); - describe('when charCode is smaller than 32', function() { - describe('when charCode is 13', function() { - it('returns 13', function() { + describe('when charCode is smaller than 32', () => { + describe('when charCode is 13', () => { + it('returns 13', () => { var nativeEvent = new KeyboardEvent('keypress', {charCode: 13}); expect(getEventCharCode(nativeEvent)).toBe(13); }); }); - describe('when charCode is not 13', function() { - it('returns 0', function() { + describe('when charCode is not 13', () => { + it('returns 0', () => { var nativeEvent = new KeyboardEvent('keypress', {charCode: 31}); expect(getEventCharCode(nativeEvent)).toBe(0); @@ -59,26 +59,26 @@ describe('getEventCharCode', function() { KeyboardEvent's 'charCode' event key cannot be deleted to simulate a missing charCode key. */ - describe('when charCode is not present in nativeEvent', function() { - describe('when keyCode is 32 or bigger', function() { - it('returns keyCode', function() { + describe('when charCode is not present in nativeEvent', () => { + describe('when keyCode is 32 or bigger', () => { + it('returns keyCode', () => { var nativeEvent = {'keyCode': 32}; expect(getEventCharCode(nativeEvent)).toBe(32); }); }); - describe('when keyCode is smaller than 32', function() { - describe('when keyCode is 13', function() { - it('returns 13', function() { + describe('when keyCode is smaller than 32', () => { + describe('when keyCode is 13', () => { + it('returns 13', () => { var nativeEvent = {'keyCode': 13}; expect(getEventCharCode(nativeEvent)).toBe(13); }); }); - describe('when keyCode is not 13', function() { - it('returns 0', function() { + describe('when keyCode is not 13', () => { + it('returns 0', () => { var nativeEvent = {'keyCode': 31}; expect(getEventCharCode(nativeEvent)).toBe(0); diff --git a/src/renderers/dom/client/utils/__tests__/getEventKey-test.js b/src/renderers/dom/client/utils/__tests__/getEventKey-test.js index 09644c6e503f8..81b370255d15a 100644 --- a/src/renderers/dom/client/utils/__tests__/getEventKey-test.js +++ b/src/renderers/dom/client/utils/__tests__/getEventKey-test.js @@ -13,18 +13,18 @@ var getEventKey = require('getEventKey'); -describe('getEventKey', function() { - describe('when key is implemented in a browser', function() { - describe('when key is not normalized', function() { - it('returns a normalized value', function() { +describe('getEventKey', () => { + describe('when key is implemented in a browser', () => { + describe('when key is not normalized', () => { + it('returns a normalized value', () => { var nativeEvent = new KeyboardEvent('keypress', {key: 'Del'}); expect(getEventKey(nativeEvent)).toBe('Delete'); }); }); - describe('when key is normalized', function() { - it('returns a key', function() { + describe('when key is normalized', () => { + it('returns a key', () => { var nativeEvent = new KeyboardEvent('keypress', {key: 'f'}); expect(getEventKey(nativeEvent)).toBe('f'); @@ -32,18 +32,18 @@ describe('getEventKey', function() { }); }); - describe('when key is not implemented in a browser', function() { - describe('when event type is keypress', function() { - describe('when charCode is 13', function() { - it("returns 'Enter'", function() { + describe('when key is not implemented in a browser', () => { + describe('when event type is keypress', () => { + describe('when charCode is 13', () => { + it("returns 'Enter'", () => { var nativeEvent = new KeyboardEvent('keypress', {charCode: 13}); expect(getEventKey(nativeEvent)).toBe('Enter'); }); }); - describe('when charCode is not 13', function() { - it('returns a string from a charCode', function() { + describe('when charCode is not 13', () => { + it('returns a string from a charCode', () => { var nativeEvent = new KeyboardEvent('keypress', {charCode: 65}); expect(getEventKey(nativeEvent)).toBe('A'); @@ -51,17 +51,17 @@ describe('getEventKey', function() { }); }); - describe('when event type is keydown or keyup', function() { - describe('when keyCode is recognized', function() { - it('returns a translated key', function() { + describe('when event type is keydown or keyup', () => { + describe('when keyCode is recognized', () => { + it('returns a translated key', () => { var nativeEvent = new KeyboardEvent('keydown', {keyCode: 45}); expect(getEventKey(nativeEvent)).toBe('Insert'); }); }); - describe('when keyCode is not recognized', function() { - it('returns Unidentified', function() { + describe('when keyCode is not recognized', () => { + it('returns Unidentified', () => { var nativeEvent = new KeyboardEvent('keydown', {keyCode: 1337}); expect(getEventKey(nativeEvent)).toBe('Unidentified'); @@ -69,8 +69,8 @@ describe('getEventKey', function() { }); }); - describe('when event type is unknown', function() { - it('returns an empty string', function() { + describe('when event type is unknown', () => { + it('returns an empty string', () => { var nativeEvent = new KeyboardEvent('keysmack'); expect(getEventKey(nativeEvent)).toBe(''); diff --git a/src/renderers/dom/client/utils/__tests__/getNodeForCharacterOffset-test.js b/src/renderers/dom/client/utils/__tests__/getNodeForCharacterOffset-test.js index d0f9a5501f8bc..170b65cc8c437 100644 --- a/src/renderers/dom/client/utils/__tests__/getNodeForCharacterOffset-test.js +++ b/src/renderers/dom/client/utils/__tests__/getNodeForCharacterOffset-test.js @@ -28,22 +28,22 @@ function expectNodeOffset(result, textContent, nodeOffset) { expect(result.offset).toBe(nodeOffset); } -describe('getNodeForCharacterOffset', function() { - it('should handle siblings', function() { +describe('getNodeForCharacterOffset', () => { + it('should handle siblings', () => { var node = createNode('123456789'); expectNodeOffset(getNodeForCharacterOffset(node, 0), '123', 0); expectNodeOffset(getNodeForCharacterOffset(node, 4), '456', 1); }); - it('should handle trailing chars', function() { + it('should handle trailing chars', () => { var node = createNode('123456789'); expectNodeOffset(getNodeForCharacterOffset(node, 3), '123', 3); expectNodeOffset(getNodeForCharacterOffset(node, 9), '789', 3); }); - it('should handle trees', function() { + it('should handle trees', () => { var node = createNode( '' + '1' + @@ -65,7 +65,7 @@ describe('getNodeForCharacterOffset', function() { expect(getNodeForCharacterOffset(node, 10)).toBeUndefined(); }); - it('should handle non-existent offset', function() { + it('should handle non-existent offset', () => { var node = createNode('123'); expect(getNodeForCharacterOffset(node, -1)).toBeUndefined(); diff --git a/src/renderers/dom/client/utils/__tests__/setInnerHTML-test.js b/src/renderers/dom/client/utils/__tests__/setInnerHTML-test.js index 32756c6d5ef7f..750f918fd1560 100644 --- a/src/renderers/dom/client/utils/__tests__/setInnerHTML-test.js +++ b/src/renderers/dom/client/utils/__tests__/setInnerHTML-test.js @@ -14,9 +14,9 @@ var setInnerHTML = require('setInnerHTML'); var DOMNamespaces = require('DOMNamespaces'); -describe('setInnerHTML', function() { +describe('setInnerHTML', () => { describe('when the node has innerHTML property', () => { - it('sets innerHTML on it', function() { + it('sets innerHTML on it', () => { var node = document.createElement('div'); var html = '

hello

'; setInnerHTML(node, html); @@ -27,7 +27,7 @@ describe('setInnerHTML', function() { describe('when the node does not have an innerHTML property', () => { // Disabled. JSDOM doesn't seem to remove nodes when using appendChild to // move existing nodes. - xit('sets innerHTML on it', function() { + xit('sets innerHTML on it', () => { // Create a mock node that looks like an SVG in IE (without innerHTML) var node = { namespaceURI: DOMNamespaces.svg, diff --git a/src/renderers/dom/client/wrappers/__tests__/DisabledInputUtil-test.js b/src/renderers/dom/client/wrappers/__tests__/DisabledInputUtil-test.js index a99546ecc25ff..ff8bcc87590bd 100644 --- a/src/renderers/dom/client/wrappers/__tests__/DisabledInputUtil-test.js +++ b/src/renderers/dom/client/wrappers/__tests__/DisabledInputUtil-test.js @@ -12,7 +12,7 @@ 'use strict'; -describe('DisabledInputUtils', function() { +describe('DisabledInputUtils', () => { var React; var ReactDOM; var ReactTestUtils; @@ -40,15 +40,15 @@ describe('DisabledInputUtils', function() { elements.forEach(function(tagName) { - describe(tagName, function() { + describe(tagName, () => { - beforeEach(function() { + beforeEach(() => { React = require('React'); ReactDOM = require('ReactDOM'); ReactTestUtils = require('ReactTestUtils'); }); - it('should forward clicks when it starts out not disabled', function() { + it('should forward clicks when it starts out not disabled', () => { var element = React.createElement(tagName, { onClick: onClick, }); @@ -56,7 +56,7 @@ describe('DisabledInputUtils', function() { expectClickThru(mounted(element)); }); - it('should not forward clicks when it starts out disabled', function() { + it('should not forward clicks when it starts out disabled', () => { var element = React.createElement(tagName, { onClick: onClick, disabled: true, @@ -65,7 +65,7 @@ describe('DisabledInputUtils', function() { expectNoClickThru(mounted(element)); }); - it('should forward clicks when it becomes not disabled', function() { + it('should forward clicks when it becomes not disabled', () => { var container = document.createElement('div'); var element = ReactDOM.render( React.createElement(tagName, { onClick: onClick, disabled: true }), @@ -78,7 +78,7 @@ describe('DisabledInputUtils', function() { expectClickThru(element); }); - it('should not forward clicks when it becomes disabled', function() { + it('should not forward clicks when it becomes disabled', () => { var container = document.createElement('div'); var element = ReactDOM.render( React.createElement(tagName, { onClick: onClick }), @@ -91,7 +91,7 @@ describe('DisabledInputUtils', function() { expectNoClickThru(element); }); - it('should work correctly if the listener is changed', function() { + it('should work correctly if the listener is changed', () => { var container = document.createElement('div'); var element = ReactDOM.render( React.createElement(tagName, { onClick: onClick, disabled: true }), diff --git a/src/renderers/dom/client/wrappers/__tests__/ReactDOMIframe-test.js b/src/renderers/dom/client/wrappers/__tests__/ReactDOMIframe-test.js index 918e07c621da3..b8e7343975774 100644 --- a/src/renderers/dom/client/wrappers/__tests__/ReactDOMIframe-test.js +++ b/src/renderers/dom/client/wrappers/__tests__/ReactDOMIframe-test.js @@ -11,18 +11,18 @@ 'use strict'; -describe('ReactDOMIframe', function() { +describe('ReactDOMIframe', () => { var React; var ReactDOM; var ReactTestUtils; - beforeEach(function() { + beforeEach(() => { React = require('React'); ReactDOM = require('ReactDOM'); ReactTestUtils = require('ReactTestUtils'); }); - it('should trigger load events', function() { + it('should trigger load events', () => { var onLoadSpy = jasmine.createSpy(); var iframe = React.createElement('iframe', {onLoad: onLoadSpy}); iframe = ReactTestUtils.renderIntoDocument(iframe); diff --git a/src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js b/src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js index e2fd10f76855c..c99c2691611c2 100644 --- a/src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js +++ b/src/renderers/dom/client/wrappers/__tests__/ReactDOMInput-test.js @@ -14,7 +14,7 @@ var emptyFunction = require('emptyFunction'); -describe('ReactDOMInput', function() { +describe('ReactDOMInput', () => { var React; var ReactDOM; var ReactDOMServer; @@ -30,7 +30,7 @@ describe('ReactDOMInput', function() { tracker.setValue(current); } - beforeEach(function() { + beforeEach(() => { jest.resetModuleRegistry(); React = require('React'); ReactDOM = require('ReactDOM'); @@ -42,7 +42,7 @@ describe('ReactDOMInput', function() { spyOn(console, 'error'); }); - it('should display `defaultValue` of number 0', function() { + it('should display `defaultValue` of number 0', () => { var stub = ; stub = ReactTestUtils.renderIntoDocument(stub); var node = ReactDOM.findDOMNode(stub); @@ -51,7 +51,7 @@ describe('ReactDOMInput', function() { expect(node.value).toBe('0'); }); - it('should display "true" for `defaultValue` of `true`', function() { + it('should display "true" for `defaultValue` of `true`', () => { var stub = ; stub = ReactTestUtils.renderIntoDocument(stub); var node = ReactDOM.findDOMNode(stub); @@ -59,7 +59,7 @@ describe('ReactDOMInput', function() { expect(node.value).toBe('true'); }); - it('should display "false" for `defaultValue` of `false`', function() { + it('should display "false" for `defaultValue` of `false`', () => { var stub = ; stub = ReactTestUtils.renderIntoDocument(stub); var node = ReactDOM.findDOMNode(stub); @@ -67,7 +67,7 @@ describe('ReactDOMInput', function() { expect(node.value).toBe('false'); }); - it('should update `defaultValue` for uncontrolled input', function() { + it('should update `defaultValue` for uncontrolled input', () => { var container = document.createElement('div'); var node = ReactDOM.render(, container); @@ -80,7 +80,7 @@ describe('ReactDOMInput', function() { expect(node.defaultValue).toBe('1'); }); - it('should update `defaultValue` for uncontrolled date/time input', function() { + it('should update `defaultValue` for uncontrolled date/time input', () => { var container = document.createElement('div'); var node = ReactDOM.render(, container); @@ -95,7 +95,7 @@ describe('ReactDOMInput', function() { ReactDOM.render(, container); }); - it('should take `defaultValue` when changing to uncontrolled input', function() { + it('should take `defaultValue` when changing to uncontrolled input', () => { var container = document.createElement('div'); var node = ReactDOM.render(, container); @@ -107,7 +107,7 @@ describe('ReactDOMInput', function() { expect(node.value).toBe('0'); }); - it('should render defaultValue for SSR', function() { + it('should render defaultValue for SSR', () => { var markup = ReactDOMServer.renderToString(); var div = document.createElement('div'); div.innerHTML = markup; @@ -115,7 +115,7 @@ describe('ReactDOMInput', function() { expect(div.firstChild.getAttribute('defaultValue')).toBe(null); }); - it('should render value for SSR', function() { + it('should render value for SSR', () => { var element = ; var markup = ReactDOMServer.renderToString(element); var div = document.createElement('div'); @@ -124,14 +124,14 @@ describe('ReactDOMInput', function() { expect(div.firstChild.getAttribute('defaultValue')).toBe(null); }); - it('should render name attribute if it is supplied', function() { + it('should render name attribute if it is supplied', () => { var container = document.createElement('div'); var node = ReactDOM.render(, container); expect(node.name).toBe('name'); expect(container.firstChild.getAttribute('name')).toBe('name'); }); - it('should render name attribute if it is supplied for SSR', function() { + it('should render name attribute if it is supplied for SSR', () => { var element = ; var markup = ReactDOMServer.renderToString(element); var div = document.createElement('div'); @@ -139,13 +139,13 @@ describe('ReactDOMInput', function() { expect(div.firstChild.getAttribute('name')).toBe('name'); }); - it('should not render name attribute if it is not supplied', function() { + it('should not render name attribute if it is not supplied', () => { var container = document.createElement('div'); ReactDOM.render(, container); expect(container.firstChild.getAttribute('name')).toBe(null); }); - it('should not render name attribute if it is not supplied for SSR', function() { + it('should not render name attribute if it is not supplied for SSR', () => { var element = ; var markup = ReactDOMServer.renderToString(element); var div = document.createElement('div'); @@ -153,7 +153,7 @@ describe('ReactDOMInput', function() { expect(div.firstChild.getAttribute('name')).toBe(null); }); - it('should display "foobar" for `defaultValue` of `objToString`', function() { + it('should display "foobar" for `defaultValue` of `objToString`', () => { var objToString = { toString: function() { return 'foobar'; @@ -167,7 +167,7 @@ describe('ReactDOMInput', function() { expect(node.value).toBe('foobar'); }); - it('should display `value` of number 0', function() { + it('should display `value` of number 0', () => { var stub = ; stub = ReactTestUtils.renderIntoDocument(stub); var node = ReactDOM.findDOMNode(stub); @@ -175,7 +175,7 @@ describe('ReactDOMInput', function() { expect(node.value).toBe('0'); }); - it('should allow setting `value` to `true`', function() { + it('should allow setting `value` to `true`', () => { var container = document.createElement('div'); var stub = ; var node = ReactDOM.render(stub, container); @@ -189,7 +189,7 @@ describe('ReactDOMInput', function() { expect(node.value).toEqual('true'); }); - it('should allow setting `value` to `false`', function() { + it('should allow setting `value` to `false`', () => { var container = document.createElement('div'); var stub = ; var node = ReactDOM.render(stub, container); @@ -203,7 +203,7 @@ describe('ReactDOMInput', function() { expect(node.value).toEqual('false'); }); - it('should allow setting `value` to `objToString`', function() { + it('should allow setting `value` to `objToString`', () => { var container = document.createElement('div'); var stub = ; var node = ReactDOM.render(stub, container); @@ -222,7 +222,7 @@ describe('ReactDOMInput', function() { expect(node.value).toEqual('foobar'); }); - it('should not incur unnecessary DOM mutations', function() { + it('should not incur unnecessary DOM mutations', () => { var container = document.createElement('div'); ReactDOM.render(, container); @@ -245,7 +245,7 @@ describe('ReactDOMInput', function() { expect(nodeValueSetter.mock.calls.length).toBe(1); }); - it('should properly control a value of number `0`', function() { + it('should properly control a value of number `0`', () => { var stub = ; stub = ReactTestUtils.renderIntoDocument(stub); var node = ReactDOM.findDOMNode(stub); @@ -255,7 +255,7 @@ describe('ReactDOMInput', function() { expect(node.value).toBe('0'); }); - it('should have the correct target value', function() { + it('should have the correct target value', () => { var handled = false; var handler = function(event) { expect(event.target.nodeName).toBe('INPUT'); @@ -279,7 +279,7 @@ describe('ReactDOMInput', function() { expect(handled).toBe(true); }); - it('should not set a value for submit buttons unnecessarily', function() { + it('should not set a value for submit buttons unnecessarily', () => { var stub = ; stub = ReactTestUtils.renderIntoDocument(stub); var node = ReactDOM.findDOMNode(stub); @@ -293,7 +293,7 @@ describe('ReactDOMInput', function() { ).toBe(true); }); - it('should control radio buttons', function() { + it('should control radio buttons', () => { class RadioGroup extends React.Component { render() { return ( @@ -351,7 +351,7 @@ describe('ReactDOMInput', function() { expect(cNode.checked).toBe(true); }); - it('should support ReactLink', function() { + it('should support ReactLink', () => { var link = new ReactLink('yolo', jest.fn()); var instance = ; @@ -368,7 +368,7 @@ describe('ReactDOMInput', function() { expect(link.requestChange.mock.calls[0][0]).toEqual('test'); }); - it('should warn with value and no onChange handler', function() { + it('should warn with value and no onChange handler', () => { var link = new ReactLink('yolo', jest.fn()); ReactTestUtils.renderIntoDocument(); expect(console.error.calls.count()).toBe(1); @@ -384,7 +384,7 @@ describe('ReactDOMInput', function() { expect(console.error.calls.count()).toBe(2); }); - it('should warn with value and no onChange handler and readOnly specified', function() { + it('should warn with value and no onChange handler and readOnly specified', () => { ReactTestUtils.renderIntoDocument( ); @@ -396,7 +396,7 @@ describe('ReactDOMInput', function() { expect(console.error.calls.count()).toBe(1); }); - it('should have a this value of undefined if bind is not used', function() { + it('should have a this value of undefined if bind is not used', () => { var unboundInputOnChange = function() { expect(this).toBe(undefined); }; @@ -407,7 +407,7 @@ describe('ReactDOMInput', function() { ReactTestUtils.Simulate.change(instance); }); - it('should throw if both value and valueLink are provided', function() { + it('should throw if both value and valueLink are provided', () => { var node = document.createElement('div'); var link = new ReactLink('yolo', jest.fn()); var instance = ; @@ -428,7 +428,7 @@ describe('ReactDOMInput', function() { }); - it('should support checkedLink', function() { + it('should support checkedLink', () => { var link = new ReactLink(true, jest.fn()); var instance = ; @@ -445,7 +445,7 @@ describe('ReactDOMInput', function() { expect(link.requestChange.mock.calls[0][0]).toEqual(false); }); - it('should warn with checked and no onChange handler', function() { + it('should warn with checked and no onChange handler', () => { var node = document.createElement('div'); var link = new ReactLink(true, jest.fn()); ReactDOM.render(, node); @@ -472,7 +472,7 @@ describe('ReactDOMInput', function() { expect(console.error.calls.count()).toBe(2); }); - it('should warn with checked and no onChange handler with readOnly specified', function() { + it('should warn with checked and no onChange handler with readOnly specified', () => { ReactTestUtils.renderIntoDocument( ); @@ -484,7 +484,7 @@ describe('ReactDOMInput', function() { expect(console.error.calls.count()).toBe(1); }); - it('should throw if both checked and checkedLink are provided', function() { + it('should throw if both checked and checkedLink are provided', () => { var node = document.createElement('div'); var link = new ReactLink(true, jest.fn()); var instance = ; @@ -506,14 +506,14 @@ describe('ReactDOMInput', function() { }); - it('should update defaultValue to empty string', function() { + it('should update defaultValue to empty string', () => { var container = document.createElement('div'); ReactDOM.render(, container); ReactDOM.render(, container); expect(container.firstChild.defaultValue).toBe(''); }); - it('should throw if both checkedLink and valueLink are provided', function() { + it('should throw if both checkedLink and valueLink are provided', () => { var node = document.createElement('div'); var link = new ReactLink(true, jest.fn()); var instance = ; @@ -528,7 +528,7 @@ describe('ReactDOMInput', function() { expect(() => ReactDOM.render(instance, node)).toThrow(); }); - it('should warn if value is null', function() { + it('should warn if value is null', () => { ReactTestUtils.renderIntoDocument(); expect(console.error.calls.argsFor(0)[0]).toContain( '`value` prop on `input` should not be null. ' + @@ -540,7 +540,7 @@ describe('ReactDOMInput', function() { expect(console.error.calls.count()).toBe(1); }); - it('should warn if checked and defaultChecked props are specified', function() { + it('should warn if checked and defaultChecked props are specified', () => { ReactTestUtils.renderIntoDocument( ); @@ -559,7 +559,7 @@ describe('ReactDOMInput', function() { expect(console.error.calls.count()).toBe(1); }); - it('should warn if value and defaultValue props are specified', function() { + it('should warn if value and defaultValue props are specified', () => { ReactTestUtils.renderIntoDocument( ); @@ -578,7 +578,7 @@ describe('ReactDOMInput', function() { expect(console.error.calls.count()).toBe(1); }); - it('should warn if controlled input switches to uncontrolled (value is undefined)', function() { + it('should warn if controlled input switches to uncontrolled (value is undefined)', () => { var stub = ; var container = document.createElement('div'); ReactDOM.render(stub, container); @@ -592,7 +592,7 @@ describe('ReactDOMInput', function() { ); }); - it('should warn if controlled input switches to uncontrolled (value is null)', function() { + it('should warn if controlled input switches to uncontrolled (value is null)', () => { var stub = ; var container = document.createElement('div'); ReactDOM.render(stub, container); @@ -606,7 +606,7 @@ describe('ReactDOMInput', function() { ); }); - it('should warn if controlled input switches to uncontrolled with defaultValue', function() { + it('should warn if controlled input switches to uncontrolled with defaultValue', () => { var stub = ; var container = document.createElement('div'); ReactDOM.render(stub, container); @@ -620,7 +620,7 @@ describe('ReactDOMInput', function() { ); }); - it('should warn if uncontrolled input (value is undefined) switches to controlled', function() { + it('should warn if uncontrolled input (value is undefined) switches to controlled', () => { var stub = ; var container = document.createElement('div'); ReactDOM.render(stub, container); @@ -634,7 +634,7 @@ describe('ReactDOMInput', function() { ); }); - it('should warn if uncontrolled input (value is null) switches to controlled', function() { + it('should warn if uncontrolled input (value is null) switches to controlled', () => { var stub = ; var container = document.createElement('div'); ReactDOM.render(stub, container); @@ -648,7 +648,7 @@ describe('ReactDOMInput', function() { ); }); - it('should warn if controlled checkbox switches to uncontrolled (checked is undefined)', function() { + it('should warn if controlled checkbox switches to uncontrolled (checked is undefined)', () => { var stub = ; var container = document.createElement('div'); ReactDOM.render(stub, container); @@ -662,7 +662,7 @@ describe('ReactDOMInput', function() { ); }); - it('should warn if controlled checkbox switches to uncontrolled (checked is null)', function() { + it('should warn if controlled checkbox switches to uncontrolled (checked is null)', () => { var stub = ; var container = document.createElement('div'); ReactDOM.render(stub, container); @@ -676,7 +676,7 @@ describe('ReactDOMInput', function() { ); }); - it('should warn if controlled checkbox switches to uncontrolled with defaultChecked', function() { + it('should warn if controlled checkbox switches to uncontrolled with defaultChecked', () => { var stub = ; var container = document.createElement('div'); ReactDOM.render(stub, container); @@ -690,7 +690,7 @@ describe('ReactDOMInput', function() { ); }); - it('should warn if uncontrolled checkbox (checked is undefined) switches to controlled', function() { + it('should warn if uncontrolled checkbox (checked is undefined) switches to controlled', () => { var stub = ; var container = document.createElement('div'); ReactDOM.render(stub, container); @@ -704,7 +704,7 @@ describe('ReactDOMInput', function() { ); }); - it('should warn if uncontrolled checkbox (checked is null) switches to controlled', function() { + it('should warn if uncontrolled checkbox (checked is null) switches to controlled', () => { var stub = ; var container = document.createElement('div'); ReactDOM.render(stub, container); @@ -718,7 +718,7 @@ describe('ReactDOMInput', function() { ); }); - it('should warn if controlled radio switches to uncontrolled (checked is undefined)', function() { + it('should warn if controlled radio switches to uncontrolled (checked is undefined)', () => { var stub = ; var container = document.createElement('div'); ReactDOM.render(stub, container); @@ -732,7 +732,7 @@ describe('ReactDOMInput', function() { ); }); - it('should warn if controlled radio switches to uncontrolled (checked is null)', function() { + it('should warn if controlled radio switches to uncontrolled (checked is null)', () => { var stub = ; var container = document.createElement('div'); ReactDOM.render(stub, container); @@ -746,7 +746,7 @@ describe('ReactDOMInput', function() { ); }); - it('should warn if controlled radio switches to uncontrolled with defaultChecked', function() { + it('should warn if controlled radio switches to uncontrolled with defaultChecked', () => { var stub = ; var container = document.createElement('div'); ReactDOM.render(stub, container); @@ -760,7 +760,7 @@ describe('ReactDOMInput', function() { ); }); - it('should warn if uncontrolled radio (checked is undefined) switches to controlled', function() { + it('should warn if uncontrolled radio (checked is undefined) switches to controlled', () => { var stub = ; var container = document.createElement('div'); ReactDOM.render(stub, container); @@ -774,7 +774,7 @@ describe('ReactDOMInput', function() { ); }); - it('should warn if uncontrolled radio (checked is null) switches to controlled', function() { + it('should warn if uncontrolled radio (checked is null) switches to controlled', () => { var stub = ; var container = document.createElement('div'); ReactDOM.render(stub, container); @@ -788,7 +788,7 @@ describe('ReactDOMInput', function() { ); }); - it('should not warn if radio value changes but never becomes controlled', function() { + it('should not warn if radio value changes but never becomes controlled', () => { var container = document.createElement('div'); ReactDOM.render(, container); ReactDOM.render(, container); @@ -798,7 +798,7 @@ describe('ReactDOMInput', function() { expect(console.error.calls.count()).toBe(0); }); - it('should not warn if radio value changes but never becomes uncontrolled', function() { + it('should not warn if radio value changes but never becomes uncontrolled', () => { var container = document.createElement('div'); ReactDOM.render( null} />, container); ReactDOM.render( @@ -812,7 +812,7 @@ describe('ReactDOMInput', function() { expect(console.error.calls.count()).toBe(0); }); - it('should warn if radio checked false changes to become uncontrolled', function() { + it('should warn if radio checked false changes to become uncontrolled', () => { var container = document.createElement('div'); ReactDOM.render( null} />, container); ReactDOM.render(, container); @@ -824,7 +824,7 @@ describe('ReactDOMInput', function() { ); }); - it('sets type, step, min, max before value always', function() { + it('sets type, step, min, max before value always', () => { if (!ReactDOMFeatureFlags.useCreateElement) { return; } @@ -860,14 +860,14 @@ describe('ReactDOMInput', function() { ]); }); - it('sets value properly with type coming later in props', function() { + it('sets value properly with type coming later in props', () => { var input = ReactTestUtils.renderIntoDocument( ); expect(input.value).toBe('hi'); }); - it('does not raise a validation warning when it switches types', function() { + it('does not raise a validation warning when it switches types', () => { var Input = React.createClass({ getInitialState() { return { type: 'number', value: 1000 }; @@ -887,7 +887,7 @@ describe('ReactDOMInput', function() { expect(node.value).toEqual('Test'); }); - it('resets value of date/time input to fix bugs in iOS Safari', function() { + it('resets value of date/time input to fix bugs in iOS Safari', () => { // https://github.com/facebook/react/issues/7233 if (!ReactDOMFeatureFlags.useCreateElement) { return; diff --git a/src/renderers/dom/client/wrappers/__tests__/ReactDOMOption-test.js b/src/renderers/dom/client/wrappers/__tests__/ReactDOMOption-test.js index d82219a9c5a93..952217dfb8518 100644 --- a/src/renderers/dom/client/wrappers/__tests__/ReactDOMOption-test.js +++ b/src/renderers/dom/client/wrappers/__tests__/ReactDOMOption-test.js @@ -12,18 +12,18 @@ 'use strict'; -describe('ReactDOMOption', function() { +describe('ReactDOMOption', () => { var React; var ReactDOM; var ReactTestUtils; - beforeEach(function() { + beforeEach(() => { React = require('React'); ReactDOM = require('ReactDOM'); ReactTestUtils = require('ReactTestUtils'); }); - it('should flatten children to a string', function() { + it('should flatten children to a string', () => { var stub = ; stub = ReactTestUtils.renderIntoDocument(stub); var node = ReactDOM.findDOMNode(stub); @@ -31,7 +31,7 @@ describe('ReactDOMOption', function() { expect(node.innerHTML).toBe('1 foo'); }); - it('should ignore and warn invalid children types', function() { + it('should ignore and warn invalid children types', () => { spyOn(console, 'error'); var stub =