Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test tools and proptypes #341

Merged
merged 4 commits into from
Oct 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/components/Base.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import { Card } from 'belle';
import { Link } from 'react-router';
import Column from './Column';
Expand Down
3 changes: 2 additions & 1 deletion docs/components/Code.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import highlightJs from 'highlight.js';
import { isEqual, omit, extend } from 'underscore';
Expand Down
3 changes: 2 additions & 1 deletion docs/components/Column.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import { omit } from 'underscore';

export default React.createClass({
Expand Down
3 changes: 2 additions & 1 deletion docs/theme/ThemeSwitch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import { Button } from 'belle';

export default React.createClass({
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
],
"peerDependencies": {
"react": ">=15.4.0",
"react-dom": ">=15.4.0"
"react-dom": ">=15.4.0",
"prop-types": ">=15.4.0"
},
"scripts": {
"build": "BABEL_ENV=production node_modules/.bin/babel --out-dir='lib' --ignore='__tests__/*' src",
Expand Down Expand Up @@ -53,9 +54,10 @@
"eslint-config-airbnb": "6.2.0",
"eslint-plugin-react": "^4.2.3",
"jest-cli": "^15.1.1",
"prop-types": "^15.5.10",
"react": "^15.4.1",
"react-addons-test-utils": "^15.4.1",
"react-dom": "^15.4.1",
"react-test-renderer": "^15.6.1",
"react-transform-catch-errors": "^1.0.2",
"react-transform-hmr": "^1.0.4",
"redbox-react": "^1.2.2",
Expand All @@ -70,7 +72,7 @@
"<rootDir>/node_modules/react",
"<rootDir>/node_modules/fbjs",
"<rootDir>/node_modules/react-dom",
"<rootDir>/node_modules/react-addons-test-utils",
"<rootDir>/node_modules/prop-types",
"../utils/helpers",
"../utils/union-class-names",
"../utils/is-component-of-type"
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/Button-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jest.dontMock('../utils/union-class-names');
jest.dontMock('../style/button');

import React from 'react';
import TestUtils from 'react-addons-test-utils';
import TestUtils from 'react-dom/test-utils';

// Babel would move an import in front of the jest.dontMock. That's why require
// is used instead of import.
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/Card-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jest.dontMock('../style/card');
jest.dontMock('../utils/inject-style');

import React from 'react';
import TestUtils from 'react-addons-test-utils';
import TestUtils from 'react-dom/test-utils';

// Babel would move an import in front of the jest.dontMock. That's why require
// is used instead of import.
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/ComboBox-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jest.dontMock('../components/ComboBoxItem');
jest.dontMock('../components/Option');

import React from 'react';
import TestUtils from 'react-addons-test-utils';
import TestUtils from 'react-dom/test-utils';

// Babel would move an import in front of the jest.dontMock. That's why require
// is used instead of import.
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/DatePicker-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jest.dontMock('../style/date-picker');

import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import TestUtils from 'react-dom/test-utils';

// Babel would move an import in front of the jest.dontMock. That's why require
// is used instead of import.
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/Option-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jest.dontMock('../components/Option');
jest.dontMock('../style/option');

import React from 'react';
import TestUtils from 'react-addons-test-utils';
import Shallow from 'react-test-renderer/shallow';

// Babel would move an import in front of the jest.dontMock. That's why require
// is used instead of import.
Expand All @@ -14,7 +14,7 @@ describe('Option', () => {
let shallowRenderer;

beforeEach(() => {
shallowRenderer = TestUtils.createRenderer();
shallowRenderer = new Shallow();
});

it('should initialise _isDisplayedAsSelected during construction', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/Placeholder-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jest.dontMock('../components/Placeholder');
jest.dontMock('../style/placeholder');

import React from 'react';
import TestUtils from 'react-addons-test-utils';
import TestUtils from 'react-dom/test-utils';

// Babel would move an import in front of the jest.dontMock. That's why require
// is used instead of import.
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/Rating-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jest.dontMock('../utils/inject-style');
jest.dontMock('../utils/union-class-names');

import React from 'react';
import TestUtils from 'react-addons-test-utils';
import TestUtils from 'react-dom/test-utils';

// Babel would move an import in front of the jest.dontMock. That's why require
// is used instead of import.
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/Select-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jest.dontMock('../components/Separator');

import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import TestUtils from 'react-dom/test-utils';

// Babel would move an import in front of the jest.dontMock. That's why require
// is used instead of import.
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/Separator-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jest.dontMock('../components/Separator');
jest.dontMock('../style/separator');

import React from 'react';
import TestUtils from 'react-addons-test-utils';
import TestUtils from 'react-dom/test-utils';

// Babel would move an import in front of the jest.dontMock. That's why require
// is used instead of import.
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/Spinner-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jest.dontMock('../components/Spinner');
jest.dontMock('../style/spinner');

import React from 'react';
import TestUtils from 'react-addons-test-utils';
import TestUtils from 'react-dom/test-utils';

// Babel would move an import in front of the jest.dontMock. That's why require
// is used instead of import.
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/TextInput-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jest.dontMock('../utils/calculate-textarea-height');
jest.dontMock('../style/text-input');

import React from 'react';
import TestUtils from 'react-addons-test-utils';
import TestUtils from 'react-dom/test-utils';

// Babel would move an import in front of the jest.dontMock. That's why require
// is used instead of import.
Expand Down
3 changes: 2 additions & 1 deletion src/components/ActionArea.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import actionAreaStyle from '../style/actionArea';
import { omit } from '../utils/helpers';

Expand Down
3 changes: 2 additions & 1 deletion src/components/Button.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react'; // eslint-disable-line no-unused-vars
import React, { Component } from 'react';
import PropTypes from 'prop-types'; // eslint-disable-line no-unused-vars
import { has, omit, uniqueId } from '../utils/helpers';
import buttonStyle from '../style/button';
import unionClassNames from '../utils/union-class-names';
Expand Down
3 changes: 2 additions & 1 deletion src/components/Card.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react'; // eslint-disable-line no-unused-vars
import React, { Component } from 'react';
import PropTypes from 'prop-types'; // eslint-disable-line no-unused-vars
import cardStyle from '../style/card';

/**
Expand Down
3 changes: 2 additions & 1 deletion src/components/Choice.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';

/**
* Choice component
Expand Down
3 changes: 2 additions & 1 deletion src/components/ComboBox.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { injectStyles, removeAllStyles } from '../utils/inject-style';
import unionClassNames from '../utils/union-class-names';
import { omit, filterReactChildren, has, isEmpty, find, getArrayForReactChildren, uniqueId } from '../utils/helpers';
Expand Down
3 changes: 2 additions & 1 deletion src/components/ComboBoxItem.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';

/**
* Belle internal component to wrap an Option in a ComboBox.
Expand Down
3 changes: 2 additions & 1 deletion src/components/DatePicker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { injectStyles, removeAllStyles } from '../utils/inject-style';
import unionClassNames from '../utils/union-class-names';
import { has, map, shift, reverse, omit, uniqueId } from '../utils/helpers';
Expand Down
3 changes: 2 additions & 1 deletion src/components/Day.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';

/**
* Belle internal component to wrap a Day in a DatePicker.
Expand Down
3 changes: 2 additions & 1 deletion src/components/DisabledDay.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';

/**
* Belle internal component to wrap a DisabledDay in a DatePicker.
Expand Down
3 changes: 2 additions & 1 deletion src/components/Option.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { omit } from '../utils/helpers';
import style from '../style/option';

Expand Down
3 changes: 2 additions & 1 deletion src/components/Placeholder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { omit } from '../utils/helpers';
import style from '../style/placeholder';

Expand Down
3 changes: 2 additions & 1 deletion src/components/Rating.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { canUseDOM } from 'exenv';
import { omit, has, uniqueId } from '../utils/helpers';
import style from '../style/rating.js';
Expand Down
3 changes: 2 additions & 1 deletion src/components/Select.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import {
omit,
Expand Down
3 changes: 2 additions & 1 deletion src/components/SelectItem.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';

/**
* Belle internal component to wrap an Option in a Select.
Expand Down
3 changes: 2 additions & 1 deletion src/components/Separator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { omit } from '../utils/helpers';
import style from '../style/separator';

Expand Down
3 changes: 2 additions & 1 deletion src/components/Spinner.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import spinnerStyle from '../style/spinner';

const animationDelay = (delay) => ({
Expand Down
3 changes: 2 additions & 1 deletion src/components/TextInput.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import calculateTextareaHeight from '../utils/calculate-textarea-height';
import { injectStyles, removeStyle } from '../utils/inject-style';
Expand Down
3 changes: 2 additions & 1 deletion src/components/Toggle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import { injectStyles, removeStyle } from '../utils/inject-style';
import { omit, has, last, first, uniqueId } from '../utils/helpers';
Expand Down