mirror of
https://github.com/greggman/virtual-webgl.git
synced 2026-01-18 14:59:32 +00:00
75 lines
2.0 KiB
HTML
75 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Virtual-WebGL Tests</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="stylesheet" href="mocha.css">
|
|
<style>
|
|
#mocha #other {
|
|
text-decoration: underline;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="mocha">
|
|
</div>
|
|
<script>
|
|
/* global window */
|
|
|
|
// this is here for puppeteer. It's resolved in index.js
|
|
// so we can await on window.testPromiseInfo
|
|
function makePromise() {
|
|
const info = {};
|
|
const promise = new Promise((resolve, reject) => {
|
|
Object.assign(info, {resolve, reject});
|
|
});
|
|
info.promise = promise;
|
|
return info;
|
|
}
|
|
|
|
window.testsPromiseInfo = makePromise();
|
|
</script>
|
|
<script src="mocha.js"></script>
|
|
<script src="../src/virtual-webgl2.js"></script>
|
|
<script type="module">
|
|
/* global document */
|
|
/* global mocha */
|
|
/* global URLSearchParams */
|
|
/* global window */
|
|
async function main() {
|
|
mocha.setup('bdd');
|
|
mocha.fullTrace();
|
|
mocha.timeout(0);
|
|
const query = Object.fromEntries(new URLSearchParams(window.location.search).entries());
|
|
if (query.timeout !== undefined) {
|
|
mocha.timeout(query.timeout);
|
|
}
|
|
const lint = query.lint !== 'false';
|
|
const throwOnError = !query.warn;
|
|
|
|
if (!throwOnError) {
|
|
const elem = document.createElement('script');
|
|
elem.dataset.gmanDebugHelper = JSON.stringify({throwOnError:false});
|
|
document.body.appendChild(elem);
|
|
}
|
|
|
|
loadScript('index.js', 'module');
|
|
}
|
|
|
|
function loadScript(url, type = 'text/javascript') {
|
|
return new Promise((resolve, reject) => {
|
|
const script = document.createElement('script');
|
|
script.onload = resolve;
|
|
script.onerror = reject;
|
|
script.type = type;
|
|
script.src = url;
|
|
document.head.appendChild(script);
|
|
});
|
|
}
|
|
|
|
main();
|
|
</script>
|
|
</body>
|
|
</html>
|