forked from aframevr/aframe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init.test.js
More file actions
37 lines (32 loc) · 1.07 KB
/
__init.test.js
File metadata and controls
37 lines (32 loc) · 1.07 KB
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
/* global sinon, setup, teardown */
/**
* __init.test.js is run before every test case.
*/
window.debug = true;
navigator.getVRDisplays = function () {
var resolvePromise = Promise.resolve();
var mockVRDisplay = {
requestPresent: resolvePromise,
exitPresent: resolvePromise,
getPose: function () { return { orientation: null, position: null }; },
requestAnimationFrame: function () { return 1; }
};
return Promise.resolve([mockVRDisplay]);
};
var AScene = require('core/scene/a-scene');
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');
});
teardown(function () {
// Clean up any attached elements.
var attachedEls = ['canvas', 'a-assets', 'a-scene'];
var els = document.querySelectorAll(attachedEls.join(','));
for (var i = 0; i < els.length; i++) {
els[i].parentNode.removeChild(els[i]);
}
this.sinon.restore();
});