Skip to content

Commit

Permalink
tests only to report issue with enzyme
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaitanya K Kamatham authored and Chaitanya K Kamatham committed Oct 8, 2017
1 parent 38b788a commit 9db4316
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 40 deletions.
5 changes: 2 additions & 3 deletions package.json
Expand Up @@ -45,6 +45,7 @@
"homepage": "https://github.com/recharts/recharts",
"peerDependencies": {
"react": "^15.0.0 || ^16.0.0",
"react-dom": "^15.0.0 || ^16.0.0",
"react-transition-group": "^2.2.1"
},
"dependencies": {
Expand All @@ -54,10 +55,10 @@
"d3-scale": "1.0.6",
"d3-shape": "1.2.0",
"lodash": "~4.17.4",
"prop-types": "~15.6.0",
"react-resize-detector": "0.6.0",
"react-smooth": "0.3.0",
"recharts-scale": "0.3.2",
"prop-types": "^15.6.0",
"reduce-css-calc": "1.3.0"
},
"devDependencies": {
Expand All @@ -81,13 +82,11 @@
"cross-env": "^5.0.5",
"enzyme": "^3.1.0",
"enzyme-adapter-react-16": "^1.0.1",
"escope": "^3.6.0",
"eslint": "^4.8.0",
"eslint-config-airbnb": "^16.0.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.4.0",
"estraverse-fb": "^1.3.2",
"json-loader": "^0.5.7",
"karma": "^1.7.1",
"karma-chai": "^0.1.0",
Expand Down
9 changes: 5 additions & 4 deletions test/karma.conf.js
Expand Up @@ -17,7 +17,7 @@ module.exports = function (config) {
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai'],

// list of files / patterns to l/oad in the browser
// list of files / patterns to load in the browser
files: [
{ pattern: 'test/index.js', included: true, watched: false },
],
Expand Down Expand Up @@ -46,7 +46,7 @@ module.exports = function (config) {
exclude: [
path.resolve('node_modules/'),
],
loader: 'babel-loader',
loader: 'babel-loader'
}, {
test: /\.json$/,
loader: 'json-loader',
Expand All @@ -55,14 +55,15 @@ module.exports = function (config) {
externals: {
jsdom: 'window',
'react/lib/ExecutionEnvironment': true,
'react/addons': true,
'react/addons': 'react',
'react/lib/ReactContext': 'window',
'text-encoding': 'window',
'react-addons-test-utils': 'react-dom'
},
resolve: {
alias: {
sinon: 'sinon/pkg/sinon',
recharts: path.resolve('./src/index.js'),
recharts: path.resolve('src/index.js'),
},
},
},
Expand Down
7 changes: 4 additions & 3 deletions test/specs/chart/LineChartSpec.js
Expand Up @@ -15,7 +15,7 @@ const data = [
{ name: 'Page F', uv: 189, pv: 4800, amt: 2400 },
];

describe('<LineChart />', () => {
describe.only('<LineChart />', () => {

it('Render 1 line in simple LineChart', () => {
const wrapper = render(
Expand Down Expand Up @@ -266,7 +266,7 @@ describe('<LineChart />', () => {
expect(onMouseUp.calledOnce).to.equal(true);
});

it('should show tooltip cursor on MouseEnter and MouseMove and hide on MouseLeave', () => {
it.only('should show tooltip cursor on MouseEnter and MouseMove and hide on MouseLeave', () => {
const margin = { top: 20, right: 20, bottom: 20, left: 20 };
const height = 400;
const width = 400;
Expand All @@ -285,13 +285,14 @@ describe('<LineChart />', () => {
expect(wrapper.find('.recharts-tooltip-cursor').length).to.equal(0);
wrapper.simulate('mouseEnter', { pageX: margin.left + 0.1 * dotSpacing, pageY: height / 2 });

console.log(wrapper.html());
let tooltipCursors = wrapper.find('.recharts-tooltip-cursor');
expect(tooltipCursors.length).to.equal(1);

// make sure tooltip is in the right spot.
const chartBottom = height - margin.top - 2 * margin.bottom;
let expectedX = margin.left;
// expect(tooltipCursors.at(0).props().d).to.equal(`M${expectedX},${margin.top}L${expectedX},${chartBottom}`);
expect(tooltipCursors.at(0).props().d).to.equal(`M${expectedX},${margin.top}L${expectedX},${chartBottom}`);

// simulate moving 10 pixels past the PageC Dot
expectedX = margin.left + dotSpacing * 2;
Expand Down
13 changes: 0 additions & 13 deletions webpack.config.js
Expand Up @@ -27,13 +27,6 @@ const config = {
}],
},

resolve: {
alias: {
react: path.resolve(__dirname, './node_modules/react'),
'react-transition-group':
path.resolve(__dirname, './node_modules/react-transition-group'),
},
},
devtool: 'source-map',

externals: {
Expand All @@ -43,12 +36,6 @@ const config = {
commonjs: 'react',
amd: 'react',
},
'react-transition-group': {
root: ['ReactTransitionGroup'],
commonjs2: 'react-transition-group',
commonjs: 'react-transition-group',
amd: 'react-transition-group',
},
'prop-types': {
root: 'PropTypes',
commonjs2: 'prop-types',
Expand Down
19 changes: 2 additions & 17 deletions yarn.lock
Expand Up @@ -1490,7 +1490,7 @@ circular-json@^0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.1.tgz#be8b36aefccde8b3ca7aa2d6afc07a37242c0d2d"

classnames@2.2.5, classnames@^2.2.5:
classnames@2.2.5:
version "2.2.5"
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.5.tgz#fb3801d453467649ef3603c7d61a02bd129bde6d"

Expand Down Expand Up @@ -2494,10 +2494,6 @@ esrecurse@^4.1.0:
estraverse "~4.1.0"
object-assign "^4.0.1"

estraverse-fb@^1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/estraverse-fb/-/estraverse-fb-1.3.2.tgz#d323a4cb5e5ac331cea033413a9253e1643e07c4"

estraverse@^1.9.1:
version "1.9.3"
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44"
Expand Down Expand Up @@ -4694,7 +4690,7 @@ prop-types@^15.5.10, prop-types@^15.5.6, prop-types@^15.5.8:
fbjs "^0.8.9"
loose-envify "^1.3.1"

prop-types@^15.5.4, prop-types@^15.6.0, prop-types@~15.6.0:
prop-types@^15.5.4, prop-types@^15.6.0:
version "15.6.0"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.0.tgz#ceaf083022fc46b4a35f69e13ef75aed0d639856"
dependencies:
Expand Down Expand Up @@ -4913,17 +4909,6 @@ react-transition-group@^1.1.1:
prop-types "^15.5.6"
warning "^3.0.0"

react-transition-group@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-2.2.1.tgz#e9fb677b79e6455fd391b03823afe84849df4a10"
dependencies:
chain-function "^1.0.0"
classnames "^2.2.5"
dom-helpers "^3.2.0"
loose-envify "^1.3.1"
prop-types "^15.5.8"
warning "^3.0.0"

react@^16.0.0:
version "16.0.0"
resolved "https://registry.yarnpkg.com/react/-/react-16.0.0.tgz#ce7df8f1941b036f02b2cca9dbd0cb1f0e855e2d"
Expand Down

0 comments on commit 9db4316

Please sign in to comment.