Skip to content

Commit bb3a624

Browse files
committed
Update for React v15.2.x
1 parent 109f37f commit bb3a624

File tree

11 files changed

+80
-51
lines changed

11 files changed

+80
-51
lines changed

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ build/Release
2727
# Dependency directory
2828
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
2929
node_modules
30+
31+
# Build artifacts
32+
/examples/static
33+
/lib

examples/PropTable.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ const PropTable = React.createClass({
121121
},
122122

123123
getType(prop) {
124-
let type = prop.type || {};
125-
let name = this.getDisplayTypeName(type.name);
126-
let doclets = prop.doclets || {};
124+
const type = prop.type || {};
125+
const name = this.getDisplayTypeName(type.name);
126+
const doclets = prop.doclets || {};
127127

128128
switch (name) {
129129
case 'object':
@@ -139,9 +139,9 @@ const PropTable = React.createClass({
139139
return i === (list.length - 1) ? current : current.concat(' | ');
140140
}, []);
141141
case 'array':
142-
let child = this.getType({ type: type.value });
143-
144-
return <span>{'array<'}{ child }{'>'}</span>;
142+
return (
143+
<span>{'array<'}{this.getType({ type: type.value })}{'>'}</span>
144+
);
145145
case 'enum':
146146
return this.renderEnum(type);
147147
case 'custom':

examples/server.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
let webpack = require('webpack');
2-
let WebpackDevServer = require('webpack-dev-server');
3-
let config = require('../webpack/examples.config');
1+
import webpack from 'webpack';
2+
import WebpackDevServer from 'webpack-dev-server';
43

5-
new WebpackDevServer(webpack(config), {
4+
import config from '../webpack/examples.config';
65

6+
const server = new WebpackDevServer(webpack(config), {
77
contentBase: 'examples',
88
publicPath: '/static/',
99
hot: true,
@@ -12,10 +12,14 @@ new WebpackDevServer(webpack(config), {
1212
stats: {
1313
colors: true
1414
}
15-
}).listen(3000, 'localhost', function (err) {
15+
});
16+
17+
server.listen(3000, 'localhost', err => {
18+
/* eslint-disable no-console */
1619
if (err) {
17-
console.log(err);
20+
console.error(err);
1821
}
1922

2023
console.log('Listening at localhost:3000');
24+
/* eslint-enable no-console */
2125
});

package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@
2424
"clean": "rimraf lib",
2525
"clean:examples": "rimraf examples/static",
2626
"build": "npm run clean && babel src --out-dir lib",
27-
"build:examples": "npm run clean:examples && babel-node ./webpack/run-webpack --config docs.config.js",
28-
"examples": "npm run clean:examples && babel-node ./examples/server.js",
29-
"lint": "eslint src test",
27+
"build:examples": "npm run clean:examples && webpack --config webpack/docs.config.js",
28+
"examples": "npm run clean:examples && babel-node examples/server.js",
29+
"lint": "eslint examples/*.js src test *.js",
3030
"test": "npm run lint && npm run testonly",
3131
"testonly": "karma start --single-run",
3232
"tdd": "karma start",
33-
"coverage": "COVERAGE=true npm run testonly",
3433
"release": "release"
3534
},
3635
"peerDependencies": {
@@ -41,7 +40,7 @@
4140
"@monastic.panic/component-playground": "^2.0.0",
4241
"babel": "^5.8.38",
4342
"babel-core": "^5.8.38",
44-
"babel-eslint": "^6.1.0",
43+
"babel-eslint": "^6.1.2",
4544
"babel-loader": "^5.4.0",
4645
"babel-plugin-object-assign": "^1.2.1",
4746
"chai": "^3.5.0",
@@ -71,11 +70,11 @@
7170
"mocha": "^2.5.3",
7271
"node-libs-browser": "^1.0.0",
7372
"raw-loader": "^0.5.1",
74-
"react": "~15.1.0",
75-
"react-addons-test-utils": "~15.1.0",
73+
"react": "^15.2.1",
74+
"react-addons-test-utils": "^15.2.1",
7675
"react-bootstrap": "^0.29.5",
7776
"react-component-metadata": "^2.1.1",
78-
"react-dom": "~15.1.0",
77+
"react-dom": "^15.2.1",
7978
"react-hot-loader": "^1.3.0",
8079
"release-script": "^1.0.2",
8180
"rimraf": "^2.5.3",

src/Position.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class Position extends React.Component {
6060
delete props.target;
6161
delete props.container;
6262
delete props.containerPadding;
63+
delete props.shouldUpdatePosition;
6364

6465
const child = React.Children.only(children);
6566
return cloneElement(

test/ModalSpec.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1+
import jQuery from 'jquery';
12
import React from 'react';
2-
import ReactDOM from 'react-dom';
33
import ReactTestUtils from 'react-addons-test-utils';
4-
import Modal from '../src/Modal';
5-
import { render } from './helpers';
6-
import jquery from 'jquery';
4+
import ReactDOM from 'react-dom';
75
import simulant from 'simulant';
6+
7+
import Modal from '../src/Modal';
8+
89
import Transition from '../src/Transition';
910

10-
let $ = componentOrNode => jquery(ReactDOM.findDOMNode(componentOrNode));
11+
import { render, shouldWarn } from './helpers';
12+
13+
const $ = componentOrNode => jQuery(ReactDOM.findDOMNode(componentOrNode));
1114

1215
describe('Modal', function () {
1316
let mountPoint;
@@ -362,18 +365,15 @@ describe('Modal', function () {
362365
});
363366

364367
it('Should warn if the modal content is not focusable', function () {
365-
let Dialog = ()=> ({ render(){ return <div/>; } });
368+
shouldWarn('The modal content node does not accept focus');
366369

367-
sinon.stub(console, 'error');
370+
const Dialog = () => <div />;
368371

369372
render(
370373
<Modal show>
371374
<Dialog />
372375
</Modal>
373376
, focusableContainer);
374-
375-
expect(console.error).to.have.been.calledOnce;
376-
console.error.restore();
377377
});
378378
});
379379

test/PositionSpec.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ import overlayPositionUtils from '../src/utils/overlayPositionUtils';
99
import {render} from './helpers';
1010

1111
describe('Position', function () {
12+
// Swallow extra props.
13+
const Span = () => <span />;
14+
1215
it('Should output a child', function () {
1316
let instance = ReactTestUtils.renderIntoDocument(
1417
<Position>
15-
<span>Text</span>
18+
<Span>Text</Span>
1619
</Position>
1720
);
1821
assert.equal(ReactDOM.findDOMNode(instance).nodeName, 'SPAN');
@@ -22,8 +25,8 @@ describe('Position', function () {
2225
expect(() => {
2326
ReactTestUtils.renderIntoDocument(
2427
<Position>
25-
<span>Text</span>
26-
<span>Another Text</span>
28+
<Span>Text</Span>
29+
<Span>Another Text</Span>
2730
</Position>
2831
);
2932
}).to.throw(Error, /onlyChild must be passed a children with exactly one child/);
@@ -61,7 +64,7 @@ describe('Position', function () {
6164
target={() => this.refs[this.state.target]}
6265
fakeProp={this.state.fakeProp}
6366
>
64-
<div />
67+
<Span />
6568
</Position>
6669
</div>
6770
);
@@ -114,7 +117,7 @@ describe('Position', function () {
114117
shouldUpdatePosition
115118
fakeProp={this.state.fakeProp}
116119
>
117-
<div />
120+
<Span />
118121
</Position>
119122
</div>
120123
);

test/TransitionSpec.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,16 @@ describe('Transition', function () {
246246
}
247247

248248
render() {
249+
const { ...props } = this.props;
250+
delete props.initialIn;
251+
249252
return (
250253
<Transition
251254
ref="transition"
252255
unmountOnExit
253256
in={this.state.in}
254257
timeout={10}
255-
{...this.props}
258+
{...props}
256259
>
257260
<div />
258261
</Transition>

test/helpers.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import ReactDOM from 'react-dom';
21
import { cloneElement } from 'react';
2+
import ReactDOM from 'react-dom';
33

44
export function shouldWarn(about) {
5-
console.warn.called.should.be.true;
6-
console.warn.calledWithMatch(about).should.be.true;
7-
console.warn.reset();
5+
console.error.expected.push(about);
86
}
97

108
/**

0 commit comments

Comments
 (0)