Skip to content

Commit ae77f63

Browse files
committed
test: adding more to html test
1 parent 37b19bd commit ae77f63

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

test/mock/basic.html

+36-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,46 @@
88
<meta name="description" content="" />
99
<meta name="viewport" content="width=device-width, initial-scale=1" />
1010
<link rel="stylesheet" href="" />
11+
<style type="text/css">
12+
.result{
13+
border:1px solid black;
14+
padding:1rem;
15+
}
16+
</style>
17+
<script type="application/javascript">
18+
const cacheData={};
19+
function setLoadingDom(selector){
20+
const el = document.querySelector(selector);
21+
el.innerHTML = '';
22+
return el;
23+
}
24+
function updateLoadingDom(el,content){
25+
const resultPre = document.createElement('pre');
26+
resultPre.innerHTML = JSON.stringify(content ,null,2);
27+
el.appendChild(resultPre);
28+
}
29+
</script>
1130
</head>
1231
<body>
1332
<h1>Basic LinearRegression</h1>
33+
<div id="modelTest"></div>
1434
<script src="../../dist/web/index.js"></script>
15-
<!-- <script type="module">
35+
<script >
36+
const csvtest1DOM= setLoadingDom('#modelTest');
37+
updateLoadingDom(csvtest1DOM,{ training:'started', });
38+
1639
let lr = new scikitjs.LinearRegression();
17-
await lr.fit([[1], [2]], [10, 20]);
18-
console.log(lr.intercept_);
19-
</script> -->
40+
async function main(){
41+
console.log('going to fit data')
42+
console.log(lr)
43+
await lr.fit([[1], [2]], [10, 20]);
44+
updateLoadingDom(csvtest1DOM,{ training:'completed', });
45+
updateLoadingDom(csvtest1DOM,{ lr });
46+
47+
console.log('fit model')
48+
console.log({lr})
49+
}
50+
main()
51+
</script>
2052
</body>
2153
</html>

0 commit comments

Comments
 (0)