Skip to content

Commit

Permalink
Merge pull request reactjs#8 from leoasis/update_react_version
Browse files Browse the repository at this point in the history
[changed] Update to React 0.12. Fix warnings.
  • Loading branch information
mzabriskie committed Dec 16, 2014
2 parents a8faa92 + 4a85cd2 commit 399b386
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
5 changes: 2 additions & 3 deletions lib/components/Modal.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/** @jsx React.DOM */
var React = require('react');
var ModalPortal = require('./ModalPortal');
var ModalPortal = React.createFactory(require('./ModalPortal'));
var ariaAppHider = require('../helpers/ariaAppHider');
var injectCSS = require('../helpers/injectCSS');

Expand Down Expand Up @@ -53,7 +52,7 @@ var Modal = module.exports = React.createClass({
if (this.portal)
this.portal.setProps(props);
else
this.portal = React.renderComponent(ModalPortal(props), this.node);
this.portal = React.render(ModalPortal(props), this.node);
},

render: function () {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
"karma-firefox-launcher": "0.1.3",
"karma-mocha": "0.1.3",
"mocha": "1.20.1",
"react": ">=0.11.0",
"react": ">=0.12.0",
"reactify": "^0.14.0",
"rf-release": "0.3.1",
"uglify-js": "2.4.15",
"webpack-dev-server": "1.6.5"
},
"peerDependencies": {
"react": ">=0.11.0"
"react": ">=0.12.0"
},
"dependencies": {},
"tags": [
Expand All @@ -57,4 +57,4 @@
"browserify-shim": {
"react": "global:React"
}
}
}
18 changes: 9 additions & 9 deletions specs/Modal.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require('./helper');
var Modal = require('../lib/components/Modal');
var React = require('react/addons');
var Modal = require('../lib/components/Modal');
var Simulate = React.addons.TestUtils.Simulate;
var ariaAppHider = require('../lib/helpers/ariaAppHider');
var button = React.DOM.button;
Expand All @@ -26,7 +26,7 @@ describe('Modal', function () {
it('throws without an appElement', function() {
var node = document.createElement('div');
throws(function() {
React.renderComponent(Modal({isOpen: true}), node);
React.render(React.createElement(Modal, {isOpen: true}), node);
});
React.unmountComponentAtNode(node);
});
Expand All @@ -35,7 +35,7 @@ describe('Modal', function () {
var app = document.createElement('div');
var node = document.createElement('div');
Modal.setAppElement(app);
React.renderComponent(Modal({isOpen: true}), node);
React.render(React.createElement(Modal, {isOpen: true}), node);
equal(app.getAttribute('aria-hidden'), 'true');
ariaAppHider.resetForTesting();
React.unmountComponentAtNode(node);
Expand All @@ -44,7 +44,7 @@ describe('Modal', function () {
it('accepts appElement as a prop', function() {
var el = document.createElement('div');
var node = document.createElement('div');
React.renderComponent(Modal({
React.render(React.createElement(Modal, {
isOpen: true,
appElement: el
}), node);
Expand All @@ -56,10 +56,10 @@ describe('Modal', function () {
var node = document.createElement('div');
var App = React.createClass({
render: function() {
return React.DOM.div({}, Modal({isOpen: true, ariaHideApp: false}, 'hello'));
return React.DOM.div({}, React.createElement(Modal, {isOpen: true, ariaHideApp: false}, 'hello'));
}
});
React.renderComponent(App(), node);
React.render(React.createElement(App), node);
var modalParent = document.body.querySelector('.ReactModalPortal').parentNode;
equal(modalParent, document.body);
React.unmountComponentAtNode(node);
Expand All @@ -75,7 +75,7 @@ describe('Modal', function () {
it('has default props', function() {
var node = document.createElement('div');
Modal.setAppElement(document.createElement('div'));
var component = React.renderComponent(Modal(), node);
var component = React.render(React.createElement(Modal), node);
var props = component.props;
equal(props.isOpen, false);
equal(props.ariaHideApp, true);
Expand Down Expand Up @@ -122,13 +122,13 @@ describe('Modal', function () {
//it('adds --before-close for animations', function() {
//var node = document.createElement('div');

//var component = React.renderComponent(Modal({
//var component = React.render(React.createElement(Modal, {
//isOpen: true,
//ariaHideApp: false,
//closeTimeoutMS: 50,
//}), node);

//component = React.renderComponent(Modal({
//component = React.render(React.createElement(Modal, {
//isOpen: false,
//ariaHideApp: false,
//closeTimeoutMS: 50,
Expand Down
4 changes: 2 additions & 2 deletions specs/helper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
assert = require('assert');
React = require('react/addons');
var Modal = require('../lib/components/Modal');
var Modal = React.createFactory(require('../lib/components/Modal'));

ReactTestUtils = React.addons.TestUtils;
ok = assert.ok;
Expand All @@ -14,7 +14,7 @@ renderModal = function(props, children, callback) {
props.ariaHideApp = false;
_currentDiv = document.createElement('div');
document.body.appendChild(_currentDiv);
return React.renderComponent(Modal(props, children), _currentDiv, callback);
return React.render(Modal(props, children), _currentDiv, callback);
};

unmountModal = function() {
Expand Down

0 comments on commit 399b386

Please sign in to comment.