Skip to content

Commit

Permalink
fix(unit-tests): fix broken unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Benitte committed May 3, 2016
1 parent 3bc33ca commit 321ef10
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 34 deletions.
12 changes: 7 additions & 5 deletions specs/Bubble.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import expect, { spyOn } from 'expect';
import React, { Component } from 'react';
import { render } from 'react-dom';
import { Bubble } from '../src/';
import { BubbleD3 } from '../src/';


describe('<Bubble>', function () {
describe('<BubbleD3>', function () {
this.timeout(10000);

let node;
Expand Down Expand Up @@ -34,9 +34,11 @@ describe('<Bubble>', function () {

it('should render a circle for each leaf', done => {
render((
<div style={{ width: 200, height: 200 }}>
<Bubble
<div style={{ width: 400, height: 400 }}>
<BubbleD3
width={400} height={400}
root={root}
valueProperty="loc"
colors="nivo"
transitionDuration={0}
/>
Expand All @@ -48,7 +50,7 @@ describe('<Bubble>', function () {
expect(circles.length).toBe(8);

done();
}, 400);
}, 4000);
})
});
});
2 changes: 2 additions & 0 deletions specs/Pie.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('<Pie>', function () {
<div style={{ width: 200, height: 200 }}>
<Chart>
<Pie
width={400} height={400}
data={data}
colors="nivo"
transitionDuration={0}
Expand All @@ -50,6 +51,7 @@ describe('<Pie>', function () {
<div style={{ width: 200, height: 200 }}>
<Chart>
<Pie
width={400} height={400}
data={data}
colors="nivo"
innerRadius={0.9}
Expand Down
17 changes: 7 additions & 10 deletions specs/RadialStack.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,13 @@ describe('<RadialStack>', function () {
['zero', 'wiggle', 'silhouette', 'expand'].forEach(offsetMode => {
it(`should support "${offsetMode}" offset mode`, done => {
render((
<div style={{ width: 200, height: 200 }}>
<Chart>
<RadialStack
layers={data}
offset={offsetMode}
colors="nivo"
transitionDuration={0}
/>
</Chart>
</div>
<RadialStack
layers={data}
width={400} height={400}
offset={offsetMode}
colors="nivo"
transitionDuration={0}
/>
), node, () => {
setTimeout(() => {
const areas = node.getElementsByClassName('nivo_radial-stack_area');
Expand Down
4 changes: 4 additions & 0 deletions specs/Tree.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe('<Tree>', function () {
root={root}
direction="horizontal"
colors="nivo"
identity={d => `${d.parent ? d.parent.id : 'root'}.${d.id}`}
transitionDuration={0}
/>
</div>
Expand All @@ -60,6 +61,7 @@ describe('<Tree>', function () {
root={root}
direction="horizontal-reverse"
colors="nivo"
identity={d => `${d.parent ? d.parent.id : 'root'}.${d.id}`}
transitionDuration={0}
/>
</div>
Expand All @@ -81,6 +83,7 @@ describe('<Tree>', function () {
root={root}
direction="vertical"
colors="nivo"
identity={d => `${d.parent ? d.parent.id : 'root'}.${d.id}`}
transitionDuration={0}
/>
</div>
Expand All @@ -102,6 +105,7 @@ describe('<Tree>', function () {
root={root}
direction="vertical-reverse"
colors="nivo"
identity={d => `${d.parent ? d.parent.id : 'root'}.${d.id}`}
transitionDuration={0}
/>
</div>
Expand Down
36 changes: 17 additions & 19 deletions specs/TreeMap.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import expect, { spyOn } from 'expect';
import React, { Component } from 'react';
import { render } from 'react-dom';
import { TreeMap } from '../src/';
import { TreeMapD3 } from '../src/';


describe('<TreeMap>', function () {
describe('<TreeMapD3>', function () {
this.timeout(10000);

let node;
Expand Down Expand Up @@ -34,14 +34,13 @@ describe('<TreeMap>', function () {

it('should render a treemap', done => {
render((
<div style={{ width: 500, height: 300 }}>
<TreeMap
root={root}
valueAccessor={d => d.loc}
colors="nivo"
transitionDuration={0}
/>
</div>
<TreeMapD3
root={root}
width={500} height={300}
valueAccessor={d => d.loc}
colors="nivo"
transitionDuration={0}
/>
), node, () => {
setTimeout(() => {
const nodes = node.getElementsByClassName('nivo_treemap_node');
Expand All @@ -56,15 +55,14 @@ describe('<TreeMap>', function () {
['squarify', 'slice', 'dice', 'slice-dice'].forEach(mode => {
it(`should support "${mode}" mode`, done => {
render((
<div style={{ width: 500, height: 300 }}>
<TreeMap
root={root}
mode={mode}
valueAccessor={d => d.loc}
colors="nivo"
transitionDuration={0}
/>
</div>
<TreeMapD3
root={root}
width={500} height={300}
mode={mode}
valueAccessor={d => d.loc}
colors="nivo"
transitionDuration={0}
/>
), node, () => {
setTimeout(() => {
const nodes = node.getElementsByClassName('nivo_treemap_node');
Expand Down

0 comments on commit 321ef10

Please sign in to comment.