Skip to content

Commit a605ef4

Browse files
committed
Enhance test UI with navigation and counter display
- Added a fixed navigation bar for improved accessibility and layout. - Introduced a test counter to display the number of selected tests. - Updated styles for better alignment and spacing in the test UI. - Ensured the counter updates dynamically based on checkbox selections.
1 parent b4143a6 commit a605ef4

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

src/puter-js/test/run.html

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,19 @@
99
body {
1010
font-family: Arial, sans-serif;
1111
}
12+
nav {
13+
z-index: 1000;
14+
display: flex;
15+
align-items: center;
16+
position: fixed;
17+
top: 0;
18+
width: 100%;
19+
background: #EEE;
20+
left: 0;
21+
padding-left: 10px;
22+
}
1223
#tests {
13-
margin-top: 20px;
24+
padding-top: 50px;
1425
}
1526
#run-tests {
1627
margin-top: 20px;
@@ -380,13 +391,18 @@
380391
const isChecked = $(this).prop('checked');
381392
$('.test-checkbox').prop('checked', isChecked);
382393
$('#fsTests-group, #kvTests-group, #aiTests-group').prop('checked', isChecked);
394+
// Update the counter display
395+
updateMasterCheckboxState();
383396
});
384397

385398
// Function to update master checkbox state
386399
function updateMasterCheckboxState() {
387400
const totalCheckboxes = $('.test-checkbox').length;
388401
const checkedCheckboxes = $('.test-checkbox:checked').length;
389402

403+
// Update the counter display
404+
$('#test-counter').text(`${checkedCheckboxes} / ${totalCheckboxes}`);
405+
390406
if (checkedCheckboxes === 0) {
391407
$('#master-checkbox').prop('checked', false).prop('indeterminate', false);
392408
} else if (checkedCheckboxes === totalCheckboxes) {
@@ -406,17 +422,23 @@
406422
updateMasterCheckboxState();
407423
});
408424

425+
// Initialize the counter display
426+
updateMasterCheckboxState();
427+
409428
});
410429

411430
</script>
412431
</head>
413432
<body>
414433

415-
<nav style="position: fixed; top: 0; width: 100%; background: #EEE; left: 0; padding-left: 10px;">
434+
<nav>
416435
<label style="margin-left: 8px; margin-right: 10px; cursor: pointer; display: inline-flex; align-items: center;">
417436
<input type="checkbox" id="master-checkbox" checked style="margin-right: 5px; transform: scale(1.2);">
418437
</label>
419-
<button id="run-tests">Run Tests</button>
438+
<span id="test-counter" style="font-size: 14px; color: #666; margin-right: 10px;"></span>
439+
<div style="flex: 1; text-align: right;">
440+
<button id="run-tests" style="margin-right: 30px;">Run Tests</button>
441+
</div>
420442
</nav>
421443
<div id="tests"></div>
422444
</body>

0 commit comments

Comments
 (0)