forked from n5ro/aframe-physics-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init.test.js
39 lines (36 loc) · 1.09 KB
/
__init.test.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
/**
* __init.test.js is run before every test case.
*/
window.debug = true;
var AScene = require('aframe').AScene;
var physics = require('../');
setup(function () {
this.sinon = sinon.sandbox.create();
// Stubs to not create a WebGL context since Travis CI runs headless.
this.sinon.stub(AScene.prototype, 'render');
this.sinon.stub(AScene.prototype, 'resize');
this.sinon.stub(AScene.prototype, 'setupRenderer');
// Mock renderer.
AScene.prototype.renderer = {
vr: {
getDevice: function () { return {requestPresent: function () {}}; },
setDevice: function () {},
setPoseTarget: function () {},
enabled: false
},
getContext: function () { return undefined; },
setAnimationLoop: function () {},
setSize: function () {},
shadowMap: {}
};
});
teardown(function () {
// Clean up any attached elements.
['canvas', 'a-assets', 'a-scene'].forEach(function (tagName) {
var els = document.querySelectorAll(tagName);
for (var i = 0; i < els.length; i++) {
els[i].parentNode.removeChild(els[i]);
}
});
this.sinon.restore();
});