From 4e4993e5b5b394f8d965549f9e57d9a419f88d31 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 12 Oct 2015 07:57:40 +0200 Subject: [PATCH] Added compatibility for react 0.14 --- CHANGELOG.md | 9 +++++++++ package.json | 4 +++- src/components/Main.js | 2 +- src/components/run.js | 3 ++- test/components/MainTest.js | 2 +- test/helpers/shallowRenderHelper.js | 4 ++-- 6 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..87aed23 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# react-webpack-template - Changelog + +## 0.2.0: +___Upgrades:___ +1. Updated React from 0.13 to 0.14 (using ```^0.14```) as version string. This included minor code changes for components (now use the splitted "React"-Package) and the runner (Using React-DOM). +2. Updated the shallow renderer for unit tests. + +___Backwards incompatible changes:___ +1. Default unit tests do not need to traverse down to `Component._store.props`, but directly to `Component.props`. Please keep this in mind when using properties in your tests. diff --git a/package.json b/package.json index 812cdb7..a6add12 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,8 @@ "dependencies": { "lodash": "^3.10.1", "normalize.css": "^3.0.3", - "react": "^0.13.3" + "react": "^0.14.0", + "react-addons-test-utils": "^0.14.0", + "react-dom": "^0.14.0" } } diff --git a/src/components/Main.js b/src/components/Main.js index 61f2708..7a477f3 100644 --- a/src/components/Main.js +++ b/src/components/Main.js @@ -1,7 +1,7 @@ require('normalize.css'); require('styles/App.css'); -import React from 'react/addons'; +import React from 'react'; let yeomanImage = require('../images/yeoman.png'); diff --git a/src/components/run.js b/src/components/run.js index 0576bd5..633e4b8 100644 --- a/src/components/run.js +++ b/src/components/run.js @@ -1,5 +1,6 @@ import React from 'react'; +import ReactDOM from 'react-dom'; import App from './Main'; // Render the main component into the dom -React.render(, document.getElementById('app')); +ReactDOM.render(, document.getElementById('app')); diff --git a/test/components/MainTest.js b/test/components/MainTest.js index 747f049..bd5155e 100644 --- a/test/components/MainTest.js +++ b/test/components/MainTest.js @@ -18,6 +18,6 @@ describe('MainComponent', () => { }); it('should have its component name as default className', () => { - expect(MainComponent._store.props.className).to.equal('index'); + expect(MainComponent.props.className).to.equal('index'); }); }); diff --git a/test/helpers/shallowRenderHelper.js b/test/helpers/shallowRenderHelper.js index 37a1363..e8cc1d4 100644 --- a/test/helpers/shallowRenderHelper.js +++ b/test/helpers/shallowRenderHelper.js @@ -5,8 +5,8 @@ * @see http://simonsmith.io/unit-testing-react-components-without-a-dom/ * @author somonsmith */ -import React from 'react/addons'; -const TestUtils = React.addons.TestUtils; +import React from 'react'; +import TestUtils from 'react-addons-test-utils'; /** * Get the shallow rendered component