-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtest.html
38 lines (28 loc) · 925 Bytes
/
test.html
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
<html>
<head>
<title>test</title>
</head>
<body>
<script type="module">
// Only used for testing.
// No longer: Run in Puppeteer by test/models.js.
import * as util from '../src/utils.js'
const modelParams = util.parseQueryString()
const name = (Object.keys(modelParams)[0] || 'hello') + 'Model'
const className = name[0].toUpperCase() + name.slice(1)
const module = await import(`./${className}.js`)
const Model = module.default
util.randomSeed() // so tests have same results
const model = new Model()
await model.startup()
model.setup()
await util.timeoutLoop(() => {
model.step()
}, 500)
const sample = util.sampleModel(model)
util.printToPage(sample)
window.modelSample = JSON.stringify(sample)
</script>
<div id="modelDiv"></div>
</body>
</html>