Skip to content

Commit 54f0f50

Browse files
committed
reorganize tests
1 parent e74a2ed commit 54f0f50

12 files changed

Lines changed: 76 additions & 69 deletions

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"eol-last": 2,
1818
"dot-notation": [2, { "allowKeywords": true }],
1919
"semi": [0, "never"],
20+
"semi-spacing": 0,
2021
"curly": 0,
2122
"eqeqeq": [2, "allow-null"],
2223
"no-undef": 2,

_test-bootstrap.js

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

karma.conf-ci.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ module.exports = function(config) {
7878
'_test-bootstrap.js': ['webpack']
7979
},
8080

81-
webpack: require('./webpack.configs').test,
81+
webpack: require('./build/test.config'),
8282
webpackServer: {
8383
noInfo: true
8484
},

karma.conf.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
'use strict';
22

33
module.exports = function (config) {
4-
5-
6-
//console.log(process.env.TRAVIS_CI)
74

85
config.set({
96

@@ -15,7 +12,7 @@ module.exports = function (config) {
1512
'./vendor/phantomjs-shim.js',
1613
'./vendor/sinon-1.10.3.js',
1714
'./vendor/jquery-1.11.2.min.js',
18-
'_test-bootstrap.js',
15+
'./test/index.js'
1916
],
2017

2118
reporters: ['mocha'],
@@ -30,12 +27,12 @@ module.exports = function (config) {
3027
browsers: [ 'PhantomJS'],
3128

3229
preprocessors: {
33-
'_test-bootstrap.js': ['webpack', 'sourcemap']
30+
'test/index.js': ['webpack', 'sourcemap']
3431
},
3532

36-
webpack: require('./webpack.configs').test,
33+
webpack: require('./build/test.config'),
3734
webpackServer: {
3835
noInfo: true
3936
}
4037
});
41-
};
38+
};

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"react-component"
2727
],
2828
"scripts": {
29-
"test": "npm run lint && mocha -R spec ./test/server.js && node _test-versions.js",
29+
"test": "npm run lint && npm run test:all",
3030
"test:all": "mocha -R spec ./test/server.js && karma start karma.conf.js --single-run=true",
3131
"tdd": "karma start",
3232
"lint": "eslint src --ext .jsx --ext .js",
@@ -43,14 +43,14 @@
4343
"build:lib": "npm run clean:lib && npm run compile:lib && npm run assets:lib",
4444
"build:docs": "npm run clean:docs && npm run compile:docs && npm run assets:docs",
4545
"build:dist": "npm run clean:dist && npm run compile:dist && npm run less && npm run assets:dist",
46-
"build": "build:lib && build:dist & build:docs",
46+
"build": "npm run build:lib && npm run build:dist & npm run build:docs",
4747
"docs": "npm run clean:docs && webpack-dev-server --config ./build/docs.config.js --hot",
4848
"dev": "webpack-dev-server --config ./build/dev.config.js --hot",
4949

5050
"major": "release major",
5151
"minor": "release minor",
5252
"patch": "release patch",
53-
"alpha": "release --preid beta",
53+
"alpha": "release --preid alpha",
5454
"beta": "release --preid beta"
5555
},
5656
"homepage": "http://jquense.github.io/react-widgets/docs/",
@@ -112,7 +112,6 @@
112112
"react-bootstrap": "0.24.5-react-pre.0",
113113
"react-dom": "^0.14.0-beta3",
114114
"react-router": "^1.0.0-beta3",
115-
"react-widgets-globalize-localizer": "file:../react-widgets-globalize-localizer",
116115
"release-script": "^0.2.7",
117116
"rimraf": "^2.4.2",
118117
"scriptjs": "^2.5.7",

src/Multiselect.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ var Multiselect = React.createClass({
276276
<div>
277277
{ shouldRenderPopup && [
278278
<List ref="list"
279-
key='0'
279+
key={0}
280280
{...listProps}
281281
readOnly={!!readOnly}
282282
disabled={!!disabled}
@@ -296,7 +296,7 @@ var Multiselect = React.createClass({
296296
}}
297297
/>,
298298
shouldShowCreate &&
299-
<ul role='listbox' id={createID} className="rw-list rw-multiselect-create-tag" key='1'>
299+
<ul key={1} role='listbox' id={createID} className="rw-list rw-multiselect-create-tag">
300300
<li onClick={this._onCreate.bind(null, searchTerm)}
301301
role='option'
302302
id={createOptionID}

src/MultiselectTagList.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ import CustomPropTypes from './util/propTypes';
55
import { instanceId } from './util/widgetHelpers';
66
import { dataText } from './util/dataHelpers';
77

8-
import {
9-
move, contains
10-
, isDisabled, isReadOnly
11-
, isDisabledItem, isReadOnlyItem } from './util/interaction';
8+
import { isDisabled, isDisabledItem, isReadOnlyItem } from './util/interaction';
129

1310
let optionId = (id, idx)=> `${id}__option__${idx}`;
1411

src/util/configuration.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import animate from './dom/animate';
33
function error(){
44
throw new Error(
55
'[React Widgets] You are attempting to use a widget that requires localization (DateTimePicker, NumberPicker)' +
6-
'but there is no localizer set. IN order to use these widgets please install a localizer')
6+
'but there is no localizer set. In order to use these widgets please install a localizer')
77
}
88

99
let dummy = {
10+
formats: error,
1011
parse: error,
1112
format:error,
1213
firstOfWeek: error

test/.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"globals": {
66
"$": true,
77
"expect": true,
8+
"sinon": true,
89
"__REACT_VERSION__": true
910
}
1011
}
Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,42 @@
11
'use strict';
2-
var server = require('karma').server
2+
var Server = require('karma').Server
33
, webpack = require('webpack')
4-
, webpackConfig = require('./webpack.configs').test;
4+
, webpackConfig = require('../build/test.config');
55

66
var plugins = webpackConfig.plugins || [];
77

88
webpackConfig.externals = {
9-
'react': 'window.React',
10-
'react/addons': 'window.React'
9+
'react': 'window.React',
10+
'react-dom': 'window.React',
11+
'react/addons': 'window.React',
12+
'react-dom/server': 'window.React'
1113
}
1214

1315

14-
var SUPPORTED_VERSIONS = ["0.12.2", "0.13.0"];
16+
var SUPPORTED_VERSIONS = ['0.14.0-rc'];
1517

1618

1719
series(SUPPORTED_VERSIONS, function(version, idx, next){
1820
console.log('-------------------------------------------');
1921
console.log('------- Testing React version: ' + version );
2022
console.log('-------------------------------------------');
2123

22-
server.start(
23-
config(version)
24-
, function(exitCode) {
25-
if ( exitCode )
26-
process.exit(exitCode)
24+
var server = new Server(config(version), function(exitCode) {
25+
if ( exitCode )
26+
process.exit(exitCode)
2727

28-
next();
29-
});
30-
}, function(){
31-
process.exit(0)
28+
next();
29+
});
30+
31+
32+
server.start();
3233
})
3334

3435
function config(version){
3536

3637
webpackConfig.plugins = plugins.concat(
3738
new webpack.DefinePlugin({
38-
'__REACT_VERSION__': JSON.stringify(version),
39+
'__REACT_VERSION__': JSON.stringify(version)
3940
})
4041
)
4142

@@ -50,7 +51,7 @@ function config(version){
5051
'https://cdnjs.cloudflare.com/ajax/libs/react/' + version + '/react-with-addons.js',
5152
'./vendor/sinon-1.10.3.js',
5253
'./vendor/jquery-1.11.2.min.js',
53-
'_test-bootstrap.js'
54+
'./test/index.js'
5455
],
5556

5657
reporters: ['mocha'],
@@ -65,7 +66,7 @@ function config(version){
6566
browsers: ['PhantomJS'],
6667

6768
preprocessors: {
68-
'_test-bootstrap.js': ['webpack']
69+
'test/index.js': ['webpack']
6970
},
7071

7172
webpack: webpackConfig,

0 commit comments

Comments
 (0)