forked from WhitestormJS/whs.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponents.spec.js
67 lines (58 loc) · 1.08 KB
/
components.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import * as WHS from '../src/index';
import {Mesh} from 'three';
const meshes = [
'Box',
'Cylinder',
'Dodecahedron',
'Extrude',
'Icosahedron',
'Lathe',
'Group',
// 'Model',
// 'Line',
'Octahedron',
'Parametric',
'Plane',
'Polyhedron',
'Ring',
'Shape',
'Sphere',
'Tetrahedron',
// 'Text',
'Torus',
'Torusknot',
'Tube'
];
const lights = [
'AmbientLight',
'DirectionalLight',
'HemisphereLight',
'PointLight',
'SpotLight'
];
const cameras = [
'PerspectiveCamera',
'CubeCamera',
'OrthographicCamera'
];
const app = new WHS.App([
new WHS.app.ElementModule(),
new WHS.app.SceneModule(),
new WHS.app.CameraModule()
]);
app.start();
[meshes, lights, cameras].forEach(category => {
category.forEach(component => {
test(component, () => {
const element = new WHS[component]();
app.add(element);
expect(app.children).toContain(element);
});
});
});
test('Group', () => {
const sphere = new WHS.Sphere();
const box = new WHS.Box();
const group = new WHS.Group(sphere, box, new Mesh());
group.addTo(app);
});