Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('with properties', (done) => {
const vm = new Vue({
template: '',
components: { VglNamespace, VglGroup },
}).$mount();
vm.$nextTick(() => {
try {
const actual = vm.$refs.o.inst.clone();
actual.updateMatrixWorld();
const expected = new Group();
expected.position.set(8, 3, -3.5);
expected.rotation.set(0.8, 0.8, 0.5, 'XZY');
expected.scale.set(1.3, 1.4, 1.1);
expected.updateMatrixWorld();
expected.uuid = actual.uuid;
expect(actual.toJSON()).toEqual(expected.toJSON());
done();
} catch (e) {
test('with properties', (done) => {
const vm = new Vue({
template: '',
components: { VglBoxGeometry, VglNamespace },
}).$mount();
vm.$nextTick(() => {
try {
const mediator = new BufferGeometry();
const expected = mediator.copy(new BoxBufferGeometry(100, 60, 80, 3, 4, 7)).toJSON();
expect(mediator.copy(vm.$refs.g.inst).toJSON()).toEqual(expected);
done();
} catch (e) {
done(e);
}
});
});
test('after properties are changed', (done) => {
test('after properties are changed', (done) => {
const vm = new Vue({
template: '',
components: { VglMeshStandardMaterial, VglNamespace },
data: { color: '#dafbc4' },
}).$mount();
vm.$nextTick(() => {
vm.color = '#abbcaf';
vm.$nextTick(() => {
try {
const expected = new MeshStandardMaterial({
color: 0xabbcaf,
});
const { inst } = vm.$refs.m;
expect(inst).toEqual(Object.assign(expected, { uuid: inst.uuid }));
done();
} catch (e) {
done(e);
test('with properties', (done) => {
const vm = new Vue({
template: '',
components: { VglMeshToonMaterial, VglNamespace },
}).$mount();
vm.$nextTick(() => {
try {
const expected = new MeshToonMaterial({
color: 0x8aeda3,
specular: 0x18283e,
shininess: 44,
});
const { inst } = vm.$refs.m;
expect(inst).toEqual(Object.assign(expected, { uuid: inst.uuid }));
done();
} catch (e) {
done(e);
}
test('without properties', (done) => {
const vm = new Vue({
template: '',
components: { VglAxesHelper, VglNamespace },
}).$mount();
vm.$nextTick(() => {
try {
const actual = new LineSegments().copy(vm.$refs.h.inst);
actual.geometry = vm.$refs.h.inst.geometry;
actual.material = vm.$refs.h.inst.material;
actual.updateMatrixWorld();
const expected = new AxesHelper();
expected.updateMatrixWorld();
expected.uuid = actual.uuid;
expected.geometry.uuid = actual.geometry.uuid;
expected.material.uuid = actual.material.uuid;
expect(actual.toJSON()).toEqual(expected.toJSON());
done();
test('with properties', (done) => {
const vm = new Vue({
template: '',
components: { VglOctahedronGeometry, VglNamespace },
}).$mount();
vm.$nextTick(() => {
try {
const mediator = new BufferGeometry();
const expected = mediator.copy(new OctahedronBufferGeometry(72.3, 2)).toJSON();
expect(mediator.copy(vm.$refs.g.inst).toJSON()).toEqual(expected);
done();
} catch (e) {
done(e);
}
});
});
test('after properties are changed', (done) => {
beforeEach(() => {
const { vglNamespace } = new Vue({ parent: new Vue(VglNamespace), inject: ['vglNamespace'] });
vglNamespace.object3ds.testSphere = new Mesh(new SphereBufferGeometry(5.4, 31.3, 30.9));
inject = { vglNamespace: { default: vglNamespace } };
});
test('the inst property should be an instance of the BoxHelper', () => {
test('after properties are changed', (done) => {
const vm = new Vue({
template: '',
components: { VglNamespace, VglLineSegments },
data: { p: '0 1 0', r: '0 0 0.2 XYZ', s: '1.1 0.9 0.8' },
}).$mount();
vm.$nextTick(() => {
vm.p = '1.1 2 0.8';
vm.r = '0.23 0.4 1.1 YZX';
vm.s = '0.8 0.7 0.9';
vm.$nextTick(() => {
try {
const actual = vm.$refs.o.inst.clone();
actual.updateMatrixWorld();
const expected = new LineSegments();
expected.position.set(1.1, 2, 0.8);
expected.rotation.set(0.23, 0.4, 1.1, 'YZX');
expected.scale.set(0.8, 0.7, 0.9);
test('after properties are changed', (done) => {
const vm = new Vue({
template: '',
components: { VglTextGeometry, VglNamespace },
data: {
font: font1,
size: 120,
height: 8,
curveSegments: 7,
bevelEnabled: false,
bevelThickness: 2,
bevelSize: 5,
bevelSegments: 3,
},
}).$mount();
new FontLoader().load(font1, (fontBefore) => {
const mediator = new BufferGeometry();
const expected1 = new TextBufferGeometry('a', {
test('with properties', (done) => {
const vm = new Vue({
template: '',
components: { VglSphereGeometry, VglNamespace },
}).$mount();
vm.$nextTick(() => {
try {
const mediator = new BufferGeometry();
const expected = mediator.copy(new SphereBufferGeometry(
82.8,
31,
13,
0.2,
1.2,
0.3,
3.8,
)).toJSON();
expect(mediator.copy(vm.$refs.g.inst).toJSON()).toEqual(expected);