Skip to content

Commit 9fa45e4

Browse files
committed
add many tems test case
1 parent df0029d commit 9fa45e4

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

spec/e2e/html/1924-many.html

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<title>Many items</title>
8+
9+
<link rel="stylesheet" href="../../../demo/demo.css"/>
10+
<script src="../../../dist/gridstack-h5.js"></script>
11+
12+
</head>
13+
<body>
14+
<div class="container-fluid">
15+
<h1>Many items speed test</h1>
16+
<div>
17+
<a class="btn btn-primary" onClick="addNewWidget()" href="#">Add Widget</a>
18+
<a class="btn btn-primary" onclick="toggleFloat()" id="float" href="#">float: true</a>
19+
</div>
20+
<br><br>
21+
<div class="grid-stack"></div>
22+
</div>
23+
<script src="events.js"></script>
24+
<script type="text/javascript">
25+
let items = [];
26+
for (i=0; i<200; i++) {
27+
items[i] = {w: Math.round(1 + 3 * Math.random()), h: Math.round(1 + 3 * Math.random()), content: String(i)};
28+
// items[i] = {w:1, h:1, content: String(i)};
29+
}
30+
31+
let grid = GridStack.init({
32+
cellHeight: 50,
33+
margin: 5,
34+
float: true,
35+
// animate: false,
36+
}).load(items);
37+
38+
addNewWidget = function() {
39+
let n = {
40+
x: Math.round(12 * Math.random()),
41+
y: Math.round(5 * Math.random()),
42+
w: Math.round(1 + 3 * Math.random()),
43+
h: Math.round(1 + 3 * Math.random()),
44+
content: 'new'
45+
};
46+
grid.addWidget(n);
47+
};
48+
49+
toggleFloat = function() {
50+
grid.float(! grid.getFloat());
51+
document.querySelector('#float').innerHTML = 'float: ' + grid.getFloat();
52+
};
53+
</script>
54+
</body>
55+
</html>

0 commit comments

Comments
 (0)