From cc09ed940fae42c428af9eded6ce42c5895ad8f1 Mon Sep 17 00:00:00 2001 From: Alex Boatwright Date: Thu, 29 Oct 2015 18:11:28 -0700 Subject: [PATCH] classes in the tests when can --- .../__tests__/ReactCompositeComponent-test.js | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js b/src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js index 9f3cf74dd5..f500645d77 100644 --- a/src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js +++ b/src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js @@ -1242,17 +1242,11 @@ describe('ReactCompositeComponent', function() { }); it('should not overwrite mutated properties', function() { - function Moo(props) { - React.Component.call(this, props); + class Moo extends React.Component { + render() { + return ; + } } - Moo.prototype = Object.create(React.Component.prototype, { - constructor: { - value: Moo, - }, - }); - Moo.prototype.render = function() { - return ; - }; Moo.defaultProps = { idx: 'moo' }; function Foo(props) { @@ -1270,15 +1264,7 @@ describe('ReactCompositeComponent', function() { }; Foo.defaultProps = { idx: 'foo' }; - function Bar() { - Foo.call(this); - } - - Bar.prototype = Object.create(Foo.prototype, { - constructor: { - value: Bar, - }, - }); + class Bar extends Foo {} Bar.defaultProps = { idx: 'bar' }; var moo = ReactTestUtils.renderIntoDocument();