-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Raphaël Benitte
committed
Jul 30, 2017
1 parent
de08c6b
commit 05565ca
Showing
127 changed files
with
10,534 additions
and
4,336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ logs | |
node_modules | ||
.idea | ||
/lib | ||
/es | ||
npm-debug.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,79 @@ | ||
import expect, { spyOn } from 'expect'; | ||
import React, { Component } from 'react'; | ||
import { render } from 'react-dom'; | ||
import { Chart, Pie } from '../src/'; | ||
import expect, { spyOn } from 'expect' | ||
import React, { Component } from 'react' | ||
import { render } from 'react-dom' | ||
import { Chart, Pie } from '../src/' | ||
|
||
describe('<Pie>', function() { | ||
this.timeout(10000) | ||
|
||
describe('<Pie>', function () { | ||
this.timeout(10000); | ||
|
||
let node; | ||
let node | ||
beforeEach(() => { | ||
node = document.createElement('div'); | ||
document.body.appendChild(node); | ||
}); | ||
node = document.createElement('div') | ||
document.body.appendChild(node) | ||
}) | ||
|
||
afterEach(() => { | ||
document.body.removeChild(node); | ||
}); | ||
document.body.removeChild(node) | ||
}) | ||
|
||
const data = [ | ||
{ label: 'a', value: 2 }, | ||
{ label: 'b', value: 2 }, | ||
{ label: 'c', value: 2 } | ||
]; | ||
{ label: 'c', value: 2 }, | ||
] | ||
|
||
it('should render a slice for each datum', done => { | ||
render(( | ||
render( | ||
<div style={{ width: 200, height: 200 }}> | ||
<Chart> | ||
<Pie | ||
width={400} height={400} | ||
width={400} | ||
height={400} | ||
data={data} | ||
colors="nivo" | ||
transitionDuration={0} | ||
/> | ||
</Chart> | ||
</div> | ||
), node, () => { | ||
setTimeout(() => { | ||
const slices = node.getElementsByClassName('nivo_pie_slice'); | ||
expect(slices).toNotBe(null); | ||
expect(slices.length).toBe(data.length); | ||
</div>, | ||
node, | ||
() => { | ||
setTimeout(() => { | ||
const slices = node.getElementsByClassName('nivo_pie_slice') | ||
expect(slices).toNotBe(null) | ||
expect(slices.length).toBe(data.length) | ||
|
||
done(); | ||
}, 400); | ||
}) | ||
}); | ||
done() | ||
}, 400) | ||
} | ||
) | ||
}) | ||
|
||
it(`should support donut mode by using 'innerRadius' property`, done => { | ||
render(( | ||
render( | ||
<div style={{ width: 200, height: 200 }}> | ||
<Chart> | ||
<Pie | ||
width={400} height={400} | ||
width={400} | ||
height={400} | ||
data={data} | ||
colors="nivo" | ||
innerRadius={0.9} | ||
transitionDuration={0} | ||
/> | ||
</Chart> | ||
</div> | ||
), node, () => { | ||
setTimeout(() => { | ||
const slices = node.getElementsByClassName('nivo_pie_slice'); | ||
expect(slices).toNotBe(null); | ||
expect(slices.length).toBe(data.length); | ||
</div>, | ||
node, | ||
() => { | ||
setTimeout(() => { | ||
const slices = node.getElementsByClassName('nivo_pie_slice') | ||
expect(slices).toNotBe(null) | ||
expect(slices.length).toBe(data.length) | ||
|
||
console.log(slices.length); | ||
console.log(slices.length) | ||
|
||
done(); | ||
}, 400); | ||
}) | ||
}); | ||
}); | ||
done() | ||
}, 400) | ||
} | ||
) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,71 @@ | ||
import expect, { spyOn } from 'expect'; | ||
import React, { Component } from 'react'; | ||
import { render } from 'react-dom'; | ||
import { Chart, RadialStack } from '../src/'; | ||
import expect, { spyOn } from 'expect' | ||
import React, { Component } from 'react' | ||
import { render } from 'react-dom' | ||
import { Chart, RadialStack } from '../src/' | ||
|
||
describe('<RadialStack>', function() { | ||
this.timeout(10000) | ||
|
||
describe('<RadialStack>', function () { | ||
this.timeout(10000); | ||
|
||
let node; | ||
let node | ||
beforeEach(() => { | ||
node = document.createElement('div'); | ||
document.body.appendChild(node); | ||
}); | ||
node = document.createElement('div') | ||
document.body.appendChild(node) | ||
}) | ||
|
||
afterEach(() => { | ||
document.body.removeChild(node); | ||
}); | ||
document.body.removeChild(node) | ||
}) | ||
|
||
const data = [ | ||
[{ x: 0, y: 10 }, { x: 1, y: 20 }, { x: 2, y: 30 }, { x: 3, y: 2 }, { x: 4, y: 80 }, { x: 5, y: 30 }], | ||
[{ x: 0, y: 10 }, { x: 1, y: 20 }, { x: 2, y: 30 }, { x: 3, y: 2 }, { x: 4, y: 20 }, { x: 5, y: 30 }], | ||
[{ x: 0, y: 10 }, { x: 1, y: 20 }, { x: 2, y: 30 }, { x: 3, y: 2 }, { x: 4, y: 40 }, { x: 5, y: 30 }] | ||
]; | ||
|
||
['zero', 'wiggle', 'silhouette', 'expand'].forEach(offsetMode => { | ||
[ | ||
{ x: 0, y: 10 }, | ||
{ x: 1, y: 20 }, | ||
{ x: 2, y: 30 }, | ||
{ x: 3, y: 2 }, | ||
{ x: 4, y: 80 }, | ||
{ x: 5, y: 30 }, | ||
], | ||
[ | ||
{ x: 0, y: 10 }, | ||
{ x: 1, y: 20 }, | ||
{ x: 2, y: 30 }, | ||
{ x: 3, y: 2 }, | ||
{ x: 4, y: 20 }, | ||
{ x: 5, y: 30 }, | ||
], | ||
[ | ||
{ x: 0, y: 10 }, | ||
{ x: 1, y: 20 }, | ||
{ x: 2, y: 30 }, | ||
{ x: 3, y: 2 }, | ||
{ x: 4, y: 40 }, | ||
{ x: 5, y: 30 }, | ||
], | ||
] | ||
;['zero', 'wiggle', 'silhouette', 'expand'].forEach(offsetMode => { | ||
it(`should support "${offsetMode}" offset mode`, done => { | ||
render(( | ||
render( | ||
<RadialStack | ||
layers={data} | ||
width={400} height={400} | ||
width={400} | ||
height={400} | ||
offset={offsetMode} | ||
colors="nivo" | ||
transitionDuration={0} | ||
/> | ||
), node, () => { | ||
setTimeout(() => { | ||
const areas = node.getElementsByClassName('nivo_radial-stack_area'); | ||
expect(areas).toNotBe(null); | ||
expect(areas.length).toBe(data.length); | ||
/>, | ||
node, | ||
() => { | ||
setTimeout(() => { | ||
const areas = node.getElementsByClassName( | ||
'nivo_radial-stack_area' | ||
) | ||
expect(areas).toNotBe(null) | ||
expect(areas.length).toBe(data.length) | ||
|
||
done(); | ||
}, 400); | ||
}); | ||
}); | ||
}); | ||
}); | ||
done() | ||
}, 400) | ||
} | ||
) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.