1 | import { test } from 'tape';
|
2 | import * as d3 from '../';
|
3 |
|
4 | test('cube naming is correct', function(t){
|
5 | const cubes = d3._3d()
|
6 | .shape('CUBE')
|
7 | .x(function(d){ return d.x; })
|
8 | .y(function(d){ return d.y; })
|
9 | .z(function(d){ return d.z; });
|
10 |
|
11 | const data = [
|
12 | [
|
13 | {x: 0, y: 0, z: 0},
|
14 | {x: 0, y: 1, z: 0},
|
15 | {x: 1, y: 1, z: 0},
|
16 | {x: 1, y: 0, z: 0},
|
17 | {x: 0, y: 0, z: 1},
|
18 | {x: 0, y: 1, z: 1},
|
19 | {x: 1, y: 1, z: 1},
|
20 | {x: 1, y: 0, z: 1},
|
21 | ]
|
22 | ];
|
23 |
|
24 | t.equal(cubes(data)[0].faces[0].face, 'front');
|
25 | t.equal(cubes(data)[0].faces[1].face, 'back');
|
26 | t.equal(cubes(data)[0].faces[2].face, 'left');
|
27 | t.equal(cubes(data)[0].faces[3].face, 'right');
|
28 | t.equal(cubes(data)[0].faces[4].face, 'top');
|
29 | t.equal(cubes(data)[0].faces[5].face, 'bottom');
|
30 | t.end();
|
31 | });
|